org.escot
Class PropertyAdapter

java.lang.Object
  |
  +--org.escot.BasicFeature
        |
        +--org.escot.PropertyAdapter
All Implemented Interfaces:
EscotFeature, EscotReferenced

public class PropertyAdapter
extends BasicFeature
implements EscotReferenced

The PropertyAdapter class represents a property other than number or string. If it has a setter it may be replaced with another instance of the type specified by the return type of the PropertyDescriptor. The feature has an original value which may be null.


Field Summary
protected  Object mBean
           
protected  Class mClass
           
protected  PropertyDescriptor mDescriptor
           
protected  Object mOriginalReference
           
protected  Object mReference
           
 
Fields inherited from class org.escot.BasicFeature
INITIAL_ATTR_CAPACITY, mAttributes, mPCSupport
 
Fields inherited from interface org.escot.EscotFeature
COLOR_ATTRIBUTE, DESCRIPTION_ATTRIBUTE, ICON16x16_ATTRIBUTE, TYPE_ATTRIBUTE
 
Constructor Summary
PropertyAdapter(Object bean, PropertyDescriptor desc)
           
 
Method Summary
 void cancelReference(Object reference)
          Reverts the reference to the original reference by calling the setter.
 boolean canReplaceReferenceWith(Object reference)
          Returns whether the reference can be replaced by the specified object.
 Object getReference()
          Returns the reference.
protected  Object getValue()
           
 boolean isReplaceable()
          Returns whether the reference can be replaced.
 void replaceReferenceWith(Object reference)
          Replaces the existing reference with the specified object.
protected  void setValue(Object value)
           
 
Methods inherited from class org.escot.BasicFeature
addPropertyChangeListener, duplicate, getAttribute, getName, putAttribute, removePropertyChangeListener, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mClass

protected Class mClass

mDescriptor

protected PropertyDescriptor mDescriptor

mBean

protected Object mBean

mOriginalReference

protected Object mOriginalReference

mReference

protected Object mReference
Constructor Detail

PropertyAdapter

public PropertyAdapter(Object bean,
                       PropertyDescriptor desc)
Method Detail

isReplaceable

public boolean isReplaceable()
Description copied from interface: EscotReferenced
Returns whether the reference can be replaced.
Specified by:
isReplaceable in interface EscotReferenced

canReplaceReferenceWith

public boolean canReplaceReferenceWith(Object reference)
Description copied from interface: EscotReferenced
Returns whether the reference can be replaced by the specified object.
Specified by:
canReplaceReferenceWith in interface EscotReferenced
Following copied from interface: org.escot.EscotReferenced
Parameters:
obj - the object that will replace the existing reference.

replaceReferenceWith

public void replaceReferenceWith(Object reference)
                          throws IllegalArgumentException
Description copied from interface: EscotReferenced
Replaces the existing reference with the specified object.
Specified by:
replaceReferenceWith in interface EscotReferenced
Following copied from interface: org.escot.EscotReferenced
Parameters:
obj - the object that will replace the existing reference.

cancelReference

public void cancelReference(Object reference)
Description copied from interface: EscotReferenced
Reverts the reference to the original reference by calling the setter. Does nothing if reference wasn't replaced, or if the reference provided is not the current one.
Specified by:
cancelReference in interface EscotReferenced
Following copied from interface: org.escot.EscotReferenced
Parameters:
obj - the object to be cancelled

getReference

public Object getReference()
Description copied from interface: EscotReferenced
Returns the reference.
Specified by:
getReference in interface EscotReferenced

getValue

protected Object getValue()

setValue

protected void setValue(Object value)