org.deduced
Class PropertyImplementation<E>

java.lang.Object
  extended by org.deduced.PropertyImplementation<E>
Type Parameters:
E - the type of value stored in the property
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Property<E>
Direct Known Subclasses:
AbstractDeducedProperty, FlyWheelDynamicPropertyCollectionController.ChildCollectionControllerListPropertyImplementation, FlyWheelDynamicPropertyCollectionController.ChildPropertyControllerListPropertyImplementation

public class PropertyImplementation<E>
extends java.lang.Object
implements Property<E>

Property. This class holds a property instance and value. The instance describes the content of this property.

Author:
Steve McDuff
See Also:
Serialized Form

Field Summary
private  PropertyCollection<?,?> instance
          instance that describes the property
private static long serialVersionUID
          the serial version
private  E value
          value of the property
 
Constructor Summary
protected PropertyImplementation()
          PropertyImplementation constructor with no arguments
  PropertyImplementation(Property<? extends E> otherProperty)
          copy constructor for Property
  PropertyImplementation(PropertyCollection<?,?> setInstance, E setValue)
          constructor for Property
 
Method Summary
static boolean arePropertiesEqual(Property<?> firstProperty, Property<?> secondProperty)
          test if 2 properties are equal depending on the type of instance they contain
static boolean arePropertyValuesEqual(boolean isReference, java.lang.Object firstValue, java.lang.Object secondValue)
          test if 2 property values are equal depending on whether a property is by reference or not.
static
<E> E
clonePropertyValue(PropertyCollection<?,?> instance, E valueToClone)
          clone Property Value
 void copy(Property<? extends E> otherProperty)
          copy a property
 boolean equals(java.lang.Object obj)
          (non-Javadoc)
 PropertyCollection<?,?> getInstance()
           
 E getValue()
           
 PropertyCollection<?,?> getValueType()
          fetch the property type of the value held by this property
 int hashCode()
          (non-Javadoc)
 boolean isValueEqual(java.lang.Object otherValue)
          test if the specified value is the same that is held by this property.
static void resetParentOnValue(java.lang.Object value, PropertyCollection<?,?> instance, PropertyCollection<?,?> parent, java.lang.Object propertyKey)
          reset Parent On Old Value
protected  void setInstance(PropertyCollection<?,?> setInstance)
          set Instance
 void setValue(E setValue)
           
static
<V> void
setValueOnProperty(Property<V> setProperty, java.lang.Object propertyKey, V value, PropertyCollection<?,?> parent)
          set Value On Property
static void setValueParent(java.lang.Object value, PropertyCollection<?,?> instance, PropertyCollection<?,?> parent, java.lang.Object keyOnParent)
          Set the parent property collection that owns the property.
 java.lang.String toString()
          (non-Javadoc)
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
the serial version

See Also:
Constant Field Values

instance

private PropertyCollection<?,?> instance
instance that describes the property


value

private E value
value of the property

Constructor Detail

PropertyImplementation

public PropertyImplementation(PropertyCollection<?,?> setInstance,
                              E setValue)
constructor for Property

Parameters:
setInstance - the instance description
setValue - the value of the property

PropertyImplementation

protected PropertyImplementation()
PropertyImplementation constructor with no arguments


PropertyImplementation

public PropertyImplementation(Property<? extends E> otherProperty)
copy constructor for Property

Parameters:
otherProperty - the property to copy
Method Detail

setInstance

protected void setInstance(PropertyCollection<?,?> setInstance)
set Instance

Parameters:
setInstance - instance to set

getInstance

public PropertyCollection<?,?> getInstance()
Specified by:
getInstance in interface Property<E>
Returns:
Returns the property instance description.

getValue

public E getValue()
Specified by:
getValue in interface Property<E>
Returns:
Returns the value.

setValue

public void setValue(E setValue)
Specified by:
setValue in interface Property<E>
Parameters:
setValue - The value to set.

setValueOnProperty

public static <V> void setValueOnProperty(Property<V> setProperty,
                                          java.lang.Object propertyKey,
                                          V value,
                                          PropertyCollection<?,?> parent)
set Value On Property

Type Parameters:
V - type of value in the property to modify
Parameters:
setProperty - the property on which to set the value
propertyKey - the the property key
value - the new property value
parent - the value parent

copy

public void copy(Property<? extends E> otherProperty)
copy a property

Specified by:
copy in interface Property<E>
Parameters:
otherProperty - the other property to copy

toString

public java.lang.String toString()
(non-Javadoc)

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

arePropertiesEqual

public static boolean arePropertiesEqual(Property<?> firstProperty,
                                         Property<?> secondProperty)
test if 2 properties are equal depending on the type of instance they contain

Parameters:
firstProperty - the first property
secondProperty - the second property
Returns:
true if both properties are equal

arePropertyValuesEqual

public static boolean arePropertyValuesEqual(boolean isReference,
                                             java.lang.Object firstValue,
                                             java.lang.Object secondValue)
test if 2 property values are equal depending on whether a property is by reference or not.

Parameters:
isReference - is the property a reference or not.
firstValue - the first value
secondValue - the second value
Returns:
true if the two values are equal

equals

public boolean equals(java.lang.Object obj)
(non-Javadoc)

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

isValueEqual

public boolean isValueEqual(java.lang.Object otherValue)
test if the specified value is the same that is held by this property. If the property is held by reference, the reference is compared. Otherwise the value is used

Specified by:
isValueEqual in interface Property<E>
Parameters:
otherValue - the value to check for equality
Returns:
true if this property contains the same value

setValueParent

public static void setValueParent(java.lang.Object value,
                                  PropertyCollection<?,?> instance,
                                  PropertyCollection<?,?> parent,
                                  java.lang.Object keyOnParent)
Set the parent property collection that owns the property. In order for the parent to be set, the property needs to own the value (i.e. it's not by reference) and the value needs to be a property collection.

Parameters:
value - the value on which to set the parent
instance - the instance used to contain the value
parent - the parent collection
keyOnParent - the key on the parent collection

resetParentOnValue

public static void resetParentOnValue(java.lang.Object value,
                                      PropertyCollection<?,?> instance,
                                      PropertyCollection<?,?> parent,
                                      java.lang.Object propertyKey)
reset Parent On Old Value

Parameters:
value - value on which to reset the parent
instance - instance used to reference the value
parent - the previous parent
propertyKey - the expected property key

clonePropertyValue

public static <E> E clonePropertyValue(PropertyCollection<?,?> instance,
                                       E valueToClone)
clone Property Value

Type Parameters:
E - the type of value to clone
Parameters:
instance - the instance of the property being cloned
valueToClone - the value to clone
Returns:
the cloned value

getValueType

public PropertyCollection<?,?> getValueType()
fetch the property type of the value held by this property

Specified by:
getValueType in interface Property<E>
Returns:
the type of the value held in this property

hashCode

public int hashCode()
(non-Javadoc)

Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()