com.ibatis.common.beans

Class ComplexBeanProbe

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
ObjectgetObject(Object object, String name)
Gets an Object property from a bean
protected ObjectgetProperty(Object object, String name)
ClassgetPropertyTypeForGetter(Object object, String name)
Returns the class that the getter will return when reading a property value.
ClassgetPropertyTypeForSetter(Object object, String name)
Returns the class that the setter expects to receive as a parameter when setting a property value.
String[]getReadablePropertyNames(Object object)
Returns an array of the readable properties exposed by a bean
String[]getWriteablePropertyNames(Object object)
Returns an array of the writeable properties exposed by a bean
booleanhasReadableProperty(Object object, String propertyName)
Checks to see if a bean has a readable property be a given name
booleanhasWritableProperty(Object object, String propertyName)
Checks to see if a bean has a writable property be a given name
voidsetObject(Object object, String name, Object value)
Sets the value of a bean property to an Object
protected voidsetProperty(Object object, String name, Object value)

Constructor Detail

ComplexBeanProbe

protected ComplexBeanProbe()

Method Detail

getObject

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

Parameters: object The bean name The property name

Returns: The property value (as an Object)

getProperty

protected Object getProperty(Object object, String name)

getPropertyTypeForGetter

public Class getPropertyTypeForGetter(Object object, 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

getPropertyTypeForSetter

public Class getPropertyTypeForSetter(Object object, 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

getReadablePropertyNames

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

Parameters: object The bean

Returns: The properties

getWriteablePropertyNames

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

Parameters: object The bean

Returns: The properties

hasReadableProperty

public boolean hasReadableProperty(Object object, 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

hasWritableProperty

public boolean hasWritableProperty(Object object, 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

setObject

public void setObject(Object object, String name, 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

setProperty

protected void setProperty(Object object, String name, Object value)
Copyright © 2011. All Rights Reserved.