com.ibatis.common.beans
Class ComplexBeanProbe

java.lang.Object
  extended bycom.ibatis.common.beans.BaseProbe
      extended bycom.ibatis.common.beans.ComplexBeanProbe
All Implemented Interfaces:
Probe

public class ComplexBeanProbe
extends BaseProbe

StaticBeanProbe provides methods that allow simple, reflective access to JavaBeans style properties. Methods are provided for all simple types as well as object types.

Examples:

StaticBeanProbe.setObject(object, propertyName, value);

Object value = StaticBeanProbe.getObject(object, propertyName);


Constructor Summary
protected ComplexBeanProbe()
           
 
Method Summary
 java.lang.Object getObject(java.lang.Object object, java.lang.String name)
          Gets an Object property from a bean
protected  java.lang.Object getProperty(java.lang.Object object, java.lang.String name)
           
 java.lang.Class getPropertyTypeForGetter(java.lang.Object object, java.lang.String name)
          Returns the class that the getter will return when reading a property value.
 java.lang.Class getPropertyTypeForSetter(java.lang.Object object, java.lang.String name)
          Returns the class that the setter expects to receive as a parameter when setting a property value.
 java.lang.String[] getReadablePropertyNames(java.lang.Object object)
          Returns an array of the readable properties exposed by a bean
 java.lang.String[] getWriteablePropertyNames(java.lang.Object object)
          Returns an array of the writeable properties exposed by a bean
 boolean hasReadableProperty(java.lang.Object object, java.lang.String propertyName)
          Checks to see if a bean has a readable property be a given name
 boolean hasWritableProperty(java.lang.Object object, java.lang.String propertyName)
          Checks to see if a bean has a writable property be a given name
 void setObject(java.lang.Object object, java.lang.String name, java.lang.Object value)
          Sets the value of a bean property to an Object
protected  void setProperty(java.lang.Object object, java.lang.String name, java.lang.Object value)
           
 
Methods inherited from class com.ibatis.common.beans.BaseProbe
getIndexedProperty, getIndexedType, setIndexedProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComplexBeanProbe

protected ComplexBeanProbe()
Method Detail

getReadablePropertyNames

public java.lang.String[] getReadablePropertyNames(java.lang.Object object)
Returns an array of the readable properties exposed by a bean

Specified by:
getReadablePropertyNames in class BaseProbe
Parameters:
object - The bean
Returns:
The properties

getWriteablePropertyNames

public java.lang.String[] getWriteablePropertyNames(java.lang.Object object)
Returns an array of the writeable properties exposed by a bean

Specified by:
getWriteablePropertyNames in class BaseProbe
Parameters:
object - The bean
Returns:
The properties

getPropertyTypeForSetter

public java.lang.Class getPropertyTypeForSetter(java.lang.Object object,
                                                java.lang.String name)
Returns the class that the setter expects to receive as a parameter when setting a property value.

Parameters:
object - The bean to check
name - The name of the property
Returns:
The type of the property

getPropertyTypeForGetter

public java.lang.Class getPropertyTypeForGetter(java.lang.Object object,
                                                java.lang.String name)
Returns the class that the getter will return when reading a property value.

Parameters:
object - The bean to check
name - The name of the property
Returns:
The type of the property

getObject

public java.lang.Object getObject(java.lang.Object object,
                                  java.lang.String name)
Gets an Object property from a bean

Parameters:
object - The bean
name - The property name
Returns:
The property value (as an Object)

setObject

public void setObject(java.lang.Object object,
                      java.lang.String name,
                      java.lang.Object value)
Sets the value of a bean property to an Object

Parameters:
object - The bean to change
name - The name of the property to set
value - The new value to set

hasWritableProperty

public boolean hasWritableProperty(java.lang.Object object,
                                   java.lang.String propertyName)
Checks to see if a bean has a writable property be a given name

Parameters:
object - The bean to check
propertyName - The property to check for
Returns:
True if the property exists and is writable

hasReadableProperty

public boolean hasReadableProperty(java.lang.Object object,
                                   java.lang.String propertyName)
Checks to see if a bean has a readable property be a given name

Parameters:
object - The bean to check
propertyName - The property to check for
Returns:
True if the property exists and is readable

getProperty

protected java.lang.Object getProperty(java.lang.Object object,
                                       java.lang.String name)
Specified by:
getProperty in class BaseProbe

setProperty

protected void setProperty(java.lang.Object object,
                           java.lang.String name,
                           java.lang.Object value)
Specified by:
setProperty in class BaseProbe