edu.umd.cfar.lamp.apploader.propertysheets
Class PropertyAdapter

java.lang.Object
  extended byedu.umd.cfar.lamp.apploader.propertysheets.PropertyAdapter
All Implemented Interfaces:
PropertyInterfacer

public abstract class PropertyAdapter
extends java.lang.Object
implements PropertyInterfacer

Simple implementation of the PropertInterfacer interface that uses java Method objects to interact with the property.


Field Summary
protected  java.lang.reflect.Method getter
           
protected  java.lang.String name
           
protected  java.lang.reflect.Method setter
           
 
Constructor Summary
PropertyAdapter()
           
 
Method Summary
 boolean equals(java.lang.Object o)
          Tests to see that the other property has the same name getter and setter.
 java.lang.String getName()
          Get the display name of the property.
 java.lang.Object getValue(java.lang.Object bean)
          Gets the current value of the property on the given bean.
 int hashCode()
          Hashes based on the name, getter and setter.
 boolean isReadable()
          Checks to see if the property may be readable.
 boolean isReadableOn(java.lang.Object bean)
          Checks to see if the property is readable on the given bean.
 boolean isWritable()
          Checks to see if the property may be settable.
 boolean isWritableOn(java.lang.Object bean)
          Checks to see if the property is writable on the given bean.
 void setValue(java.lang.Object bean, java.lang.Object value)
          Sets a specific property of the passed bean to the given value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.umd.cfar.lamp.apploader.propertysheets.PropertyInterfacer
getPropertyClass
 

Field Detail

name

protected java.lang.String name

getter

protected java.lang.reflect.Method getter

setter

protected java.lang.reflect.Method setter
Constructor Detail

PropertyAdapter

public PropertyAdapter()
Method Detail

hashCode

public int hashCode()
Hashes based on the name, getter and setter.

Returns:
a hash code

equals

public boolean equals(java.lang.Object o)
Tests to see that the other property has the same name getter and setter.

Parameters:
o - the other property adapter to compare with
Returns:
true iff both this and the parameter are property adapters that refer the the same name, getter and setter

setValue

public void setValue(java.lang.Object bean,
                     java.lang.Object value)
Description copied from interface: PropertyInterfacer
Sets a specific property of the passed bean to the given value.

Specified by:
setValue in interface PropertyInterfacer
Parameters:
bean - The java object to set the property specified by this PropertyInterfacer instance of.
value - The new value for the property
See Also:
PropertyInterfacer.setValue(java.lang.Object, java.lang.Object)

getValue

public java.lang.Object getValue(java.lang.Object bean)
Description copied from interface: PropertyInterfacer
Gets the current value of the property on the given bean.

Specified by:
getValue in interface PropertyInterfacer
Parameters:
bean -
Returns:
See Also:
PropertyInterfacer.getValue(java.lang.Object)

isWritableOn

public boolean isWritableOn(java.lang.Object bean)
Description copied from interface: PropertyInterfacer
Checks to see if the property is writable on the given bean.

Specified by:
isWritableOn in interface PropertyInterfacer
Parameters:
bean - The bean to check
Returns:
true if the bean's property may be written
See Also:
PropertyInterfacer.isWritableOn(java.lang.Object)

isReadableOn

public boolean isReadableOn(java.lang.Object bean)
Description copied from interface: PropertyInterfacer
Checks to see if the property is readable on the given bean.

Specified by:
isReadableOn in interface PropertyInterfacer
Parameters:
bean - The bean to check
Returns:
true if the bean's property may be read
See Also:
PropertyInterfacer.isReadableOn(java.lang.Object)

isReadable

public boolean isReadable()
Description copied from interface: PropertyInterfacer
Checks to see if the property may be readable.

Specified by:
isReadable in interface PropertyInterfacer
Returns:
true if there exists some instances that allow this property to be read.
See Also:
PropertyInterfacer.isReadable()

isWritable

public boolean isWritable()
Description copied from interface: PropertyInterfacer
Checks to see if the property may be settable.

Specified by:
isWritable in interface PropertyInterfacer
Returns:
true if there exists some instances that allow this property to be set.
See Also:
PropertyInterfacer.isWritable()

getName

public java.lang.String getName()
Description copied from interface: PropertyInterfacer
Get the display name of the property.

Specified by:
getName in interface PropertyInterfacer
Returns:
The (possibly localized) display name.
See Also:
PropertyInterfacer.getName()