com.ibatis.common.beans

Class GenericProbe

public class GenericProbe 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 GenericProbe()
Method Summary
ObjectgetObject(Object object, String name)
Gets an object from a Map or bean
protected ObjectgetProperty(Object object, String property)
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)
Gets an array of the readable properties in a Map or JavaBean
String[]getWriteablePropertyNames(Object object)
Gets an array of the writeable properties in a Map or JavaBean
booleanhasReadableProperty(Object object, String propertyName)
Checks to see if a bean has a readable property by a given name
booleanhasWritableProperty(Object object, String propertyName)
Checks to see if an object has a writable property by a given name
voidsetObject(Object object, String name, Object value)
Sets an object in a Map or bean
protected voidsetProperty(Object object, String property, Object value)

Constructor Detail

GenericProbe

protected GenericProbe()

Method Detail

getObject

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

Parameters: object - the object to probe name - the name of the property (or map entry)

Returns: The value of the property (or map entry)

See Also: BaseProbe

getProperty

protected Object getProperty(Object object, String property)

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

See Also: Probe

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 class to check name - the name of the property

Returns: The type of the property

See Also: Probe

getReadablePropertyNames

public String[] getReadablePropertyNames(Object object)
Gets an array of the readable properties in a Map or JavaBean

Parameters: object - the object to get properties for

Returns: The array of properties (or map entries)

See Also: BaseProbe

getWriteablePropertyNames

public String[] getWriteablePropertyNames(Object object)
Gets an array of the writeable properties in a Map or JavaBean

Parameters: object - the object to get properties for

Returns: The array of properties (or map entries)

See Also: BaseProbe

hasReadableProperty

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

Parameters: object The bean to check propertyName The property to check for

Returns: True if the property exists and is readable

See Also: Probe

hasWritableProperty

public boolean hasWritableProperty(Object object, String propertyName)
Checks to see if an object has a writable property by a given name

Parameters: object The bean to check propertyName The property to check for

Returns: True if the property exists and is writable

See Also: Probe

setObject

public void setObject(Object object, String name, Object value)
Sets an object in a Map or bean

Parameters: object - the object to probe name - the name of the property (or map entry) value - the new value of the property (or map entry)

See Also: BaseProbe

setProperty

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