Package com.ibatis.common.beans
Class GenericProbe
java.lang.Object
com.ibatis.common.beans.BaseProbe
com.ibatis.common.beans.GenericProbe
- All Implemented Interfaces:
Probe
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
-
Method Summary
Modifier and TypeMethodDescriptionGets an object from a Map or beanprotected Object
getProperty
(Object object, String property) Gets the property.getPropertyTypeForGetter
(Object object, String name) Returns the class that the getter will return when reading a property value.getPropertyTypeForSetter
(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 JavaBeanString[]
getWriteablePropertyNames
(Object object) Gets an array of the writeable properties in a Map or JavaBeanboolean
hasReadableProperty
(Object object, String propertyName) Checks to see if a bean has a readable property by a given nameboolean
hasWritableProperty
(Object object, String propertyName) Checks to see if an object has a writable property by a given namevoid
Sets an object in a Map or beanprotected void
setProperty
(Object object, String property, Object value) Sets the property.Methods inherited from class com.ibatis.common.beans.BaseProbe
getIndexedProperty, getIndexedType, setIndexedProperty
-
Constructor Details
-
GenericProbe
protected GenericProbe()Instantiates a new generic probe.
-
-
Method Details
-
getObject
Gets an object from a Map or bean- Parameters:
object
- - the object to probename
- - the name of the property (or map entry)- Returns:
- The value of the property (or map entry)
- See Also:
-
setObject
Sets an object in a Map or bean- Parameters:
object
- - the object to probename
- - the name of the property (or map entry)value
- - the new value of the property (or map entry)- See Also:
-
getReadablePropertyNames
Gets an array of the readable properties in a Map or JavaBean- Specified by:
getReadablePropertyNames
in classBaseProbe
- Parameters:
object
- - the object to get properties for- Returns:
- The array of properties (or map entries)
- See Also:
-
getWriteablePropertyNames
Gets an array of the writeable properties in a Map or JavaBean- Specified by:
getWriteablePropertyNames
in classBaseProbe
- Parameters:
object
- - the object to get properties for- Returns:
- The array of properties (or map entries)
- See Also:
-
getPropertyTypeForSetter
Returns the class that the setter expects to receive as a parameter when setting a property value.- Parameters:
object
- - The class to checkname
- - the name of the property- Returns:
- The type of the property
- See Also:
-
getPropertyTypeForGetter
Returns the class that the getter will return when reading a property value.- Parameters:
object
- The bean to checkname
- The name of the property- Returns:
- The type of the property
- See Also:
-
hasWritableProperty
Checks to see if an object has a writable property by a given name- Parameters:
object
- The bean to checkpropertyName
- The property to check for- Returns:
- True if the property exists and is writable
- See Also:
-
hasReadableProperty
Checks to see if a bean has a readable property by a given name- Parameters:
object
- The bean to checkpropertyName
- The property to check for- Returns:
- True if the property exists and is readable
- See Also:
-
setProperty
Description copied from class:BaseProbe
Sets the property.- Specified by:
setProperty
in classBaseProbe
- Parameters:
object
- the objectproperty
- the propertyvalue
- the value
-
getProperty
Description copied from class:BaseProbe
Gets the property.- Specified by:
getProperty
in classBaseProbe
- Parameters:
object
- the objectproperty
- the property- Returns:
- the property
-