com.metamatrix.common.object
Interface PropertiedObjectEditor

All Superinterfaces:
PropertyAccessPolicy, UserTransactionFactory
All Known Subinterfaces:
DirectoryEntryEditor, PropertiedObjectsEditor, TreeNodeEditor
All Known Implementing Classes:
BasicTreeNodeEditor, ConfigurationPropertiedObjectEditor, ConsolePropertiedEditor, DefaultTreeNodeEditor, FileSystemEntryEditor, PropertiedObjectEditorImpl, PropertiedObjectsEditorImpl, ResourcePropertiedObjectEditor

public interface PropertiedObjectEditor
extends PropertyAccessPolicy, UserTransactionFactory

This interface represents an object that can view and edit properties for a PropertiedObject. It is conceptually a stateless object that requires in all methods the reference to the PropertiedObject.


Field Summary
static java.lang.Object NO_VALUE
          The value object that is returned by this interface's methods when there is no value for the specified PropertyDefinition.
 
Fields inherited from interface com.metamatrix.common.object.PropertyAccessPolicy
DEFAULT_READ_ONLY_PRIVILEGE
 
Method Summary
 java.util.List getAllowedValues(PropertiedObject obj, PropertyDefinition def)
          Get the allowed values for the property on the specified object.
 PropertyAccessPolicy getPolicy()
           
 java.util.List getPropertyDefinitions(PropertiedObject obj)
          Obtain the list of PropertyDefinitions that apply to the specified object's type.
 java.lang.Object getValue(PropertiedObject obj, PropertyDefinition def)
          Obtain from the specified PropertiedObject the property value that corresponds to the specified PropertyDefinition.
 boolean isReadOnly(PropertiedObject obj)
          Return whether this editor may be used to set property values on the specified PropertiedObject.
 boolean isValidValue(PropertiedObject obj, PropertyDefinition def, java.lang.Object value)
          Return whether the specified value is considered valid.
 void setPolicy(PropertyAccessPolicy policy)
           
 void setValue(PropertiedObject obj, PropertyDefinition def, java.lang.Object value)
          Set on the specified PropertiedObject the value defined by the specified PropertyDefinition.
 
Methods inherited from interface com.metamatrix.common.object.PropertyAccessPolicy
isReadOnly, reset, setReadOnly, setReadOnly
 
Methods inherited from interface com.metamatrix.common.transaction.UserTransactionFactory
createReadTransaction, createWriteTransaction, createWriteTransaction
 

Field Detail

NO_VALUE

static final java.lang.Object NO_VALUE
The value object that is returned by this interface's methods when there is no value for the specified PropertyDefinition.

Method Detail

getPropertyDefinitions

java.util.List getPropertyDefinitions(PropertiedObject obj)
Obtain the list of PropertyDefinitions that apply to the specified object's type.

Parameters:
obj - the propertied object for which the PropertyDefinitions are to be obtained; may not be null
Returns:
an unmodifiable list of the PropertyDefinition objects that define the properties for the object; never null but possibly empty
Throws:
java.lang.AssertionError - if obj is null

getAllowedValues

java.util.List getAllowedValues(PropertiedObject obj,
                                PropertyDefinition def)
Get the allowed values for the property on the specified object.

Parameters:
obj - the propertied object whose property value is to be obtained; may not be null
def - the reference to the PropertyDefinition describing the property whose value is to be returned; may not be null
Returns:
the unmodifiable list of allowed values for this property, or an empty set if the values do not have to conform to a fixed set.
See Also:
#hasAllowedValues

isReadOnly

boolean isReadOnly(PropertiedObject obj)
Return whether this editor may be used to set property values on the specified PropertiedObject.

Specified by:
isReadOnly in interface PropertyAccessPolicy
Parameters:
obj - the propertied object; may not be null
Returns:
true if the object may not be modified, or false otherwise.
Throws:
java.lang.AssertionError - if obj is null

getValue

java.lang.Object getValue(PropertiedObject obj,
                          PropertyDefinition def)
Obtain from the specified PropertiedObject the property value that corresponds to the specified PropertyDefinition. The return type and cardinality (including whether the value may be null) depend upon the PropertyDefinition. If the property definition allows multiple values (i.e., its maximum multiplicity is greater than 1), the returned Object will be an Object[] containing Objects of the type prescribed by the PropertyDefinition.

Parameters:
obj - the propertied object whose property value is to be obtained; may not be null
def - the reference to the PropertyDefinition describing the property whose value is to be returned; may not be null
Returns:
the value for the property, which will be an object array if the property is multi-valued; the result may be null if the multiplicity includes "0", or the result may be the NO_VALUE reference if the specified object does not contain the specified PropertyDefinition
Throws:
java.lang.AssertionError - if either of obj or def is null

isValidValue

boolean isValidValue(PropertiedObject obj,
                     PropertyDefinition def,
                     java.lang.Object value)
Return whether the specified value is considered valid. The value is not valid if the propertied object does not have the specified property definition, or if it does but the value is inconsistent with the requirements of the property definition. If the property is multi-valued, the value is expected to be an instance of Object[].

Parameters:
obj - the propertied object whose property value is to be validated; may not be null
def - the reference to the PropertyDefinition describing the property whose value is to be validated; may not be null
value - the proposed value for the property, which must be an object array if the property is multi-valued, and which may be null if the multiplicity includes "0"
Returns:
true if the value is considered valid, or false otherwise.
Throws:
java.lang.AssertionError - if either of obj or def is null, or if the property is multi-valued and the value is not an instance of Object[].

setValue

void setValue(PropertiedObject obj,
              PropertyDefinition def,
              java.lang.Object value)
Set on the specified PropertiedObject the value defined by the specified PropertyDefinition.

Parameters:
obj - the propertied object whose property value is to be set; may not be null
def - the reference to the PropertyDefinition describing the property whose value is to be changed; may not be null
value - the proposed value for the property, which must be an object array if the property is multi-valued, and which may be null if the multiplicity includes "0"
Throws:
java.lang.IllegalArgumentException - if the value does not correspond to the PropertyDefinition requirements.
java.lang.AssertionError - if either of obj or def is null, or if the property is multi-valued and the value is not an instance of Object[].

getPolicy

PropertyAccessPolicy getPolicy()

setPolicy

void setPolicy(PropertyAccessPolicy policy)


Copyright © 2009. All Rights Reserved.