org.apache.hivemind.util
Class PropertyAdaptor

java.lang.Object
  extended by org.apache.hivemind.util.PropertyAdaptor

public class PropertyAdaptor
extends java.lang.Object

Used to manage dynamic access to a property of a specific class.

Author:
Howard Lewis Ship

Method Summary
 java.lang.String getPropertyName()
           
 java.lang.Class getPropertyType()
           
 java.lang.String getReadMethodName()
          Returns the name of the method used to read the property, or null if the property is not readable.
 java.lang.String getWriteMethodName()
          Returns the name of the method used to write the property, or null if the property is not writable.
 boolean isReadable()
          Returns true if there's a read method for the property.
 boolean isWritable()
          Returns true if there's a write method for the property.
 java.lang.Object read(java.lang.Object target)
          Reads the property of the target object.
 void smartWrite(java.lang.Object target, java.lang.String value)
           
 void write(java.lang.Object target, java.lang.Object value)
          Updates the property of the target object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getReadMethodName

public java.lang.String getReadMethodName()
Returns the name of the method used to read the property, or null if the property is not readable.


getWriteMethodName

public java.lang.String getWriteMethodName()
Returns the name of the method used to write the property, or null if the property is not writable.


getPropertyName

public java.lang.String getPropertyName()

getPropertyType

public java.lang.Class getPropertyType()

write

public void write(java.lang.Object target,
                  java.lang.Object value)
Updates the property of the target object.

Parameters:
target - the object to update
value - the value to be stored into the target object property

smartWrite

public void smartWrite(java.lang.Object target,
                       java.lang.String value)

isWritable

public boolean isWritable()
Returns true if there's a write method for the property.


read

public java.lang.Object read(java.lang.Object target)
Reads the property of the target object.

Parameters:
target - the object to read a property from

isReadable

public boolean isReadable()
Returns true if there's a read method for the property.