Package org.apache.empire.commons
Class BeanPropertyUtils
java.lang.Object
org.apache.empire.commons.BeanPropertyUtils
BeanPropertyUtils provides methods for getting and setting bean property values
It is a replacement for org.apache.commons.beanutils.BeanUtils
- Author:
- rainer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classProvided the implementation for the BeanUtils methods -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectconvertPropertyValue(Object value, Class<?> type) Converts a bean property value to a specific Java typeReturns the BeanUtils implementationstatic ObjectgetProperty(Object bean, String property) Returns the property of a bean by calling the correponding getter functionstatic inthasProperty(Object bean, String property, boolean writeAccess) Checks if a bean has a particular property and a corresponding getter/setter method existsstatic voidAllows to override the implementationstatic booleansetProperty(Object bean, String property, Object value) Set a single property value of a java bean object used by readProperties.
-
Constructor Details
-
BeanPropertyUtils
public BeanPropertyUtils()
-
-
Method Details
-
getImplementation
Returns the BeanUtils implementation- Returns:
- the new BeanUtils implementation
-
setImplementation
Allows to override the implementation- Parameters:
utils- the new BeanUtils implementation
-
hasProperty
Checks if a bean has a particular property and a corresponding getter/setter method exists- Parameters:
bean- the bean to checkproperty- the property to checkwriteAccess- flag whether to check for the getter method (false) or the setter method (true)- Returns:
- 1 if the getter/setter exists, 0 if the getter/setter does not exist, and -1 if the property does not exist at all
-
getProperty
Returns the property of a bean by calling the correponding getter function- Parameters:
bean- the beanproperty- the property name- Returns:
- the property value
-
setProperty
Set a single property value of a java bean object used by readProperties. Return false if the property does not exist or if no setter method exists (read only) throws BeanPropertySetException if an error occurs in the setter method- Parameters:
bean- the beanproperty- the propertyvalue- the value- Returns:
- true if the property has been set or false if the property does not exist or if no setter method exists
-
convertPropertyValue
Converts a bean property value to a specific Java type- Parameters:
value- the value to converttype- the type- Returns:
- the converted value
-