Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.hivemind.util
Class PropertyAdaptor  view PropertyAdaptor download PropertyAdaptor.java

java.lang.Object
  extended byorg.apache.hivemind.util.PropertyAdaptor

public class PropertyAdaptor
extends java.lang.Object

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


Field Summary
private  java.lang.String _propertyName
           
private  java.lang.Class _propertyType
           
private  java.lang.reflect.Method _readMethod
           
private  java.lang.reflect.Method _writeMethod
           
 
Constructor Summary
(package private) PropertyAdaptor(java.lang.String propertyName, java.lang.Class propertyType, java.lang.reflect.Method readMethod, java.lang.reflect.Method writeMethod)
           
 
Method Summary
private  java.lang.Object convertValueForAssignment(java.lang.Object target, java.lang.String value)
           
 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.
private  java.lang.Object instantiateViaStringConstructor(java.lang.Object target, java.lang.String value)
          Checks to see if this adaptor's property type has a public constructor that takes a single String argument.
 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
 

Field Detail

_propertyName

private java.lang.String _propertyName

_propertyType

private java.lang.Class _propertyType

_readMethod

private java.lang.reflect.Method _readMethod

_writeMethod

private java.lang.reflect.Method _writeMethod
Constructor Detail

PropertyAdaptor

PropertyAdaptor(java.lang.String propertyName,
                java.lang.Class propertyType,
                java.lang.reflect.Method readMethod,
                java.lang.reflect.Method writeMethod)
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.


smartWrite

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

convertValueForAssignment

private java.lang.Object convertValueForAssignment(java.lang.Object target,
                                                   java.lang.String value)
Since:
1.1

instantiateViaStringConstructor

private java.lang.Object instantiateViaStringConstructor(java.lang.Object target,
                                                         java.lang.String value)
Checks to see if this adaptor's property type has a public constructor that takes a single String argument.


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.


isReadable

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