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

Quick Search    Search Deep

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

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

class ClassAdaptor
extends java.lang.Object

Provides access to an object (of a particular class) as a set of individual property that may be read or updated.


Field Summary
private  java.util.Map _propertyAdaptorMap
           
 
Constructor Summary
(package private) ClassAdaptor(java.beans.PropertyDescriptor[] properties)
           
 
Method Summary
 void configureProperties(java.lang.Object target, java.lang.String initializer)
          Does the grunt work for PropertyUtils.configureProperties(Object, String) 55 .
private  void configurePropertyFromToken(java.lang.Object target, java.lang.String token)
          The token is either: propertyName=value propertyName !propertyName The later two are for boolean properties (true and false, respectively).
(package private)  PropertyAdaptor getPropertyAdaptor(java.lang.Object target, java.lang.String propertyName)
           
 java.lang.Class getPropertyType(java.lang.Object target, java.lang.String propertyName)
          Returns the type of the named property.
 java.util.List getReadableProperties()
          Returns a List of the names of readable properties (properties with a non-null getter).
 java.util.List getWriteableProperties()
          Returns a List of the names of readable properties (properties with a non-null setter).
 boolean isReadable(java.lang.String propertyName)
          Returns true if the named property exists and is readable.
 boolean isWritable(java.lang.String propertyName)
          Returns true if the named property exists and is writable.
 java.lang.Object read(java.lang.Object target, java.lang.String propertyName)
          Reads the property of the target object.
 void smartWrite(java.lang.Object target, java.lang.String propertyName, java.lang.String value)
          An improved version of write(Object, String, Object) 55 that can convert a string value to an appropriate property type value.
 void write(java.lang.Object target, java.lang.String propertyName, 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

_propertyAdaptorMap

private final java.util.Map _propertyAdaptorMap
Constructor Detail

ClassAdaptor

ClassAdaptor(java.beans.PropertyDescriptor[] properties)
Method Detail

write

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


smartWrite

public void smartWrite(java.lang.Object target,
                       java.lang.String propertyName,
                       java.lang.String value)
An improved version of write(Object, String, Object) 55 that can convert a string value to an appropriate property type value.

Since:
1.1

read

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


getPropertyType

public java.lang.Class getPropertyType(java.lang.Object target,
                                       java.lang.String propertyName)
Returns the type of the named property.


isReadable

public boolean isReadable(java.lang.String propertyName)
Returns true if the named property exists and is readable.


isWritable

public boolean isWritable(java.lang.String propertyName)
Returns true if the named property exists and is writable.


getPropertyAdaptor

PropertyAdaptor getPropertyAdaptor(java.lang.Object target,
                                   java.lang.String propertyName)

getReadableProperties

public java.util.List getReadableProperties()
Returns a List of the names of readable properties (properties with a non-null getter).


getWriteableProperties

public java.util.List getWriteableProperties()
Returns a List of the names of readable properties (properties with a non-null setter).


configureProperties

public void configureProperties(java.lang.Object target,
                                java.lang.String initializer)
Does the grunt work for PropertyUtils.configureProperties(Object, String) 55 .

Since:
1.1

configurePropertyFromToken

private void configurePropertyFromToken(java.lang.Object target,
                                        java.lang.String token)
The token is either:
  • propertyName=value
  • propertyName
  • !propertyName
The later two are for boolean properties (true and false, respectively).

Since:
1.1