com.metamatrix.common.object
Interface PropertiedObjectsEditor

All Superinterfaces:
PropertiedObjectEditor, PropertyAccessPolicy, UserTransactionFactory
All Known Implementing Classes:
PropertiedObjectsEditorImpl

public interface PropertiedObjectsEditor
extends PropertiedObjectEditor


Field Summary
static java.lang.Object DIFFERENT_VALUES
          The value object that is returned by this interface's getValue(PropertyDefinition) method when there is no common value for that property definition on every object in the list
 
Fields inherited from interface com.metamatrix.common.object.PropertiedObjectEditor
NO_VALUE
 
Fields inherited from interface com.metamatrix.common.object.PropertyAccessPolicy
DEFAULT_READ_ONLY_PRIVILEGE
 
Method Summary
 java.util.List getObjects()
          Return the ordered list of PropertiedObject instances that this editor is set to use.
 java.util.List getSharedPropertyDefinitions()
          Obtain the list of PropertyDefinitions that are defined by all of the propertied objects this editor is set to use.
 java.lang.Object getValue(int index, PropertyDefinition def)
          Obtain from the PropertiedObject at the specified index the property value that corresponds to the specified PropertyDefinition.
 java.lang.Object getValue(PropertyDefinition def)
          Determine whether all of PropertiedObjects this editor is using have the same value for the specified PropertyDefinition.
 java.util.List getValues(PropertyDefinition def)
          Return the ordered list of property values for the specified property definition, ordered by the list of PropertiedObjects that this editor is currently set to use.
 boolean hasObjects()
          Return whether this editor currently is set to use any PropertiedObjects.
 boolean isValidValue(int index, PropertyDefinition def, java.lang.Object value)
          Return whether the specified value is considered valid.
 void setObjects(java.util.List objects)
          Set the ordered list of PropertiedObject instances that this editor is to use.
 void setValue(int index, PropertyDefinition def, java.lang.Object value)
          Set the value of the property defined by the PropertyDefinition on the Propertied PropertiedObject at the specified index in this editor's list of objects.
 void setValue(PropertyDefinition def, java.lang.Object value)
          Set the specified value for the PropertyDefinition on all of PropertiedObjects this editor is using.
 void setValues(PropertyDefinition def, java.util.List values)
          Set the value for the specified PropertyDefinition on each of the PropertiedObject instances that this editor is set to use.
 
Methods inherited from interface com.metamatrix.common.object.PropertiedObjectEditor
getAllowedValues, getPolicy, getPropertyDefinitions, getValue, isReadOnly, isValidValue, setPolicy, setValue
 
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

DIFFERENT_VALUES

static final java.lang.Object DIFFERENT_VALUES
The value object that is returned by this interface's getValue(PropertyDefinition) method when there is no common value for that property definition on every object in the list

Method Detail

setObjects

void setObjects(java.util.List objects)
Set the ordered list of PropertiedObject instances that this editor is to use.

Parameters:
objects - the instances of PropertiedObject that are to be used this this editor; may be null or a zero-length collection.

getObjects

java.util.List getObjects()
Return the ordered list of PropertiedObject instances that this editor is set to use.

Returns:
the instances of PropertiedObject that are used this this editor; may be null or a zero-length collection.

hasObjects

boolean hasObjects()
Return whether this editor currently is set to use any PropertiedObjects.

Returns:
true if this editor has at least one PropertiedObject that it is set to use, or false otherwise.

getSharedPropertyDefinitions

java.util.List getSharedPropertyDefinitions()
Obtain the list of PropertyDefinitions that are defined by all of the propertied objects this editor is set to use.

Returns:
an unmodifiable list of the PropertyDefinition objects that are shared by all instances used by this editor; never null but possibly empty

getValues

java.util.List getValues(PropertyDefinition def)
Return the ordered list of property values for the specified property definition, ordered by the list of PropertiedObjects that this editor is currently set to use. If this editor has no objects that it is using, then this method returns an empty List.

The type of objects in the list and whether the list may contain null references depend upon the type and cardinality defined by the PropertyDefinition.

Parameters:
def - the reference to the PropertyDefinition describing the property value is to be returned; may not be null
Returns:
the list of values for the property, one for each PropertiedObject this editor is set to use and ordered in the same order; the value of the references in the returned List are dependent upon the PropertyDefinition (i.e., they are a Collection if the property is multi-valued, or may be null if the multiplicity includes "0")
Throws:
java.lang.AssertionError - if def is null

setValues

void setValues(PropertyDefinition def,
               java.util.List values)
Set the value for the specified PropertyDefinition on each of the PropertiedObject instances that this editor is set to use. The values are correlated to the PropertiedObjects by the order of each list; thus the following must be true:

(this.hasObjects() && ( values.size() == this.getObjects().size() )

If a PropertiedObject instance in the list of objects this editor is using that does not have the specified PropertyDefinition, the value is not set on that object.

Parameters:
def - the reference to the PropertyDefinition describing the property whose values are to be changed; may not be null
values - the new values for the property organized in the same order as the list of PropertiedObjects that this editor is currently using; may not be null although it may contain null values if the PropertyDefinition has a multiplicity that includes "0")
Throws:
java.lang.IllegalArgumentException - if any of the values are considered invalid for the PropertyDefinition.
java.lang.AssertionError - if either of def or values is null

getValue

java.lang.Object getValue(int index,
                          PropertyDefinition def)
Obtain from the PropertiedObject at the specified index 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.

Parameters:
obj - the propertied object whose property value is to be obtained; may not be null
index - the index of the PropertiedObject whose property value is to be returned; must be within the range of the list of PropertiedObjects
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 may be a collection if the property is multi-valued, or may be null if the multiplicity includes "0", or the NO_VALUE reference if the specified object does not contain the specified PropertyDefinition
Throws:
java.lang.IndexOutOfBoundsException - if index is out of range (index < 0 || index >= this.getObjects().size()).
java.lang.AssertionError - if def is null

isValidValue

boolean isValidValue(int index,
                     PropertyDefinition def,
                     java.lang.Object value)
Return whether the specified value is considered valid.

Parameters:
index - the index of the PropertiedObject whose property value is to be returned; must be within the range of the list of PropertiedObjects
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 may be a collection if the property is multi-valued, or may be null if the multiplicity includes "0"
Returns:
true if the value is considered valid, or false otherwise.
Throws:
java.lang.IndexOutOfBoundsException - if index is out of range (index < 0 || index >= this.getObjects().size()).
java.lang.AssertionError - if def is null

setValue

void setValue(int index,
              PropertyDefinition def,
              java.lang.Object value)
Set the value of the property defined by the PropertyDefinition on the Propertied PropertiedObject at the specified index in this editor's list of objects.

Parameters:
index - the index of the PropertiedObject whose property value is to be returned; must be within the range of the list of PropertiedObjects
def - the reference to the PropertyDefinition describing the property whose value is to be changed; may not be null
value - the new value for the property; the cardinality and type must conform PropertyDefinition
Throws:
java.lang.IllegalArgumentException - if the value does not correspond to the PropertyDefinition requirements.
java.lang.IndexOutOfBoundsException - if index is out of range (index < 0 || index >= this.getObjects().size()).
java.lang.AssertionError - if def is null, or if the object is read only

getValue

java.lang.Object getValue(PropertyDefinition def)
Determine whether all of PropertiedObjects this editor is using have the same value for the specified PropertyDefinition. If they do, then return that value; if not, then return the PropertiedObjectsEditor.DIFFERENT_VALUES object.

Parameters:
def - the reference to the PropertyDefinition describing the property whose values are to be evaluated for equivalency; may not be null
Returns:
the uniform value that all of the PropertiedObject instances this editor is using have, or PropertiedObjectsEditor.DIFFERENT_VALUES if at least two of the values are different; never null

setValue

void setValue(PropertyDefinition def,
              java.lang.Object value)
Set the specified value for the PropertyDefinition on all of PropertiedObjects this editor is using. The value must be considered valid for the specified PropertyDefinition. If a PropertiedObject instance in the list of objects this editor is using that does not have the specified PropertyDefinition, the value is not set on that object.

Parameters:
def - the reference to the PropertyDefinition describing the property whose value is to be set on all referenced PropertiedObjects; may not be null
value - the new value for the property; the cardinality and type must conform PropertyDefinition
Throws:
java.lang.IllegalArgumentException - if the value is considered invalid for the PropertyDefinition.


Copyright © 2009. All Rights Reserved.