public class BeanUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
getDescription(String propertyName)
Converts the given property name into a description.
|
static List<String> |
getMutablePropertyNamesOptional(Class<?> beanClass)
Returns an unmodifiable list of all property names of the given bean
class for which a read method and a write method exists.
|
static Class<?> |
getPropertyTypeOptional(Class<?> beanClass,
String propertyName)
Returns the type of the property with the given name in the given
bean class.
|
static Method |
getReadMethodOptional(Class<?> beanClass,
String propertyName)
Returns the read method for the property with the given name in the
given bean class.
|
static Method |
getWriteMethodOptional(Class<?> beanClass,
String propertyName)
Returns the write method for the property with the given name
in the given bean class.
|
static Object |
invokeReadMethodOptional(Object bean,
String propertyName)
Invokes the read method for the property with the given name on
the given object, and returns the result.
|
static void |
invokeWriteMethodOptional(Object bean,
String propertyName,
Object value)
Invokes the write-method on the given object for the property with
the given name, passing in the given value.
|
static void |
setAllOptional(Object targetBean,
Object sourceBean)
Set all properties of the target bean to the values obtained
from the source bean.
|
public static void setAllOptional(Object targetBean, Object sourceBean)
getMutablePropertyNamesOptional(Class). For each
property, the corresponding read-method of the source bean class
will be called to obtain the value. This value will then be passed
to the target bean by calling the write-method for the property.targetBean - The target beansourceBean - The source beanpublic static String getDescription(String propertyName)
inputFileName will
be converted into the String Input File Name.propertyName - The property namepublic static void invokeWriteMethodOptional(Object bean, String propertyName, Object value)
bean - The object to call the method onpropertyName - The property namevalue - The value to pass to the methodpublic static Object invokeReadMethodOptional(Object bean, String propertyName)
null will be returned in this case.bean - The object to invoke the method onpropertyName - The name of the property to querypublic static List<String> getMutablePropertyNamesOptional(Class<?> beanClass)
beanClass - The bean classpublic static Class<?> getPropertyTypeOptional(Class<?> beanClass, String propertyName)
null if there is no such property,
or the property is an indexed property that does not allow non-indexed
access.beanClass - The bean classpropertyName - The property namenull if there
is no such property.public static Method getWriteMethodOptional(Class<?> beanClass, String propertyName)
beanClass - The bean classpropertyName - The property namenull if no appropriate
write method is found.public static Method getReadMethodOptional(Class<?> beanClass, String propertyName)
beanClass - The bean classpropertyName - The property namenull
if no appropriate read method is found.Copyright © 2020. All rights reserved.