Class BeanUtils
- java.lang.Object
-
- org.vedantatree.expressionoasis.utils.BeanUtils
-
public final class BeanUtils extends Object
This class provides the util methods for bean management. One can handle bean using these util method like method invocation by name property accessing by the name and many more.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PropertyDescriptor
getPropertyDescriptor(Class beanClass, String property)
Gets the property descriptor for the property name from given class.static Class
getPropertyType(Class beanClass, String property)
Gets the return type of property.static Object
getPropertyValue(Object bean, String property)
Gets the value of property from the bean object.static boolean
isPropertyEditable(Class beanClass, String property)
Checks whether the property is editable or not.static void
setPropertyValue(Object bean, String property, Object value)
Sets the value of property to the object of bean
-
-
-
Method Detail
-
isPropertyEditable
public static final boolean isPropertyEditable(Class beanClass, String property) throws IntrospectionException
Checks whether the property is editable or not. Generally it checks whether the mutator is available for this property or not. A property is editable iff the property mutator is available.- Parameters:
beanClass
- the class of bean whose property is being inspecting.property
- the name of property to inspect.- Returns:
- Returns
true
if the property is editable elsefalse
- Throws:
IntrospectionException
-
getPropertyType
public static final Class getPropertyType(Class beanClass, String property) throws IntrospectionException
Gets the return type of property.- Parameters:
beanClass
- the class of bean whose property is being inspecting.property
- the name of property- Returns:
- the type of property. Returns
null
if the property name if not found in bean class. - Throws:
IntrospectionException
-
getPropertyValue
public static final Object getPropertyValue(Object bean, String property) throws IntrospectionException, IllegalArgumentException, IllegalAccessException, InvocationTargetException
Gets the value of property from the bean object.- Parameters:
bean
- the object of bean class whose property is to access.property
- the name of property.- Returns:
- the value of property.
- Throws:
IntrospectionException
IllegalArgumentException
IllegalAccessException
InvocationTargetException
-
setPropertyValue
public static final void setPropertyValue(Object bean, String property, Object value) throws IntrospectionException, IllegalArgumentException, IllegalAccessException, InvocationTargetException
Sets the value of property to the object of bean- Parameters:
bean
- the bean object whose proeprty is to set.property
- the name of property.value
- the value to set for the property.- Throws:
IntrospectionException
IllegalArgumentException
IllegalAccessException
InvocationTargetException
-
getPropertyDescriptor
public static final PropertyDescriptor getPropertyDescriptor(Class beanClass, String property) throws IntrospectionException
Gets the property descriptor for the property name from given class.- Parameters:
beanClass
- the class of beanproperty
- the name of property.- Returns:
- the property descriptor if property name found else return
null
. - Throws:
IntrospectionException
-
-