public class BeanUtils
extends java.lang.Object
These methods are provided purely for convenience to frequent operations. No exceptions are thrown from the methods.
Constructor and Description |
---|
BeanUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String[] |
getPropertyNames(java.lang.Object obj)
Get list of property names of bean.
|
static java.lang.Object |
getValue(java.lang.Object obj,
java.lang.String property)
Get a single property of the bean.
|
static java.util.Map |
getValues(java.lang.Object obj,
java.lang.String[] allowedProperties)
Get Map of property values from a bean.
|
static boolean |
setValue(java.lang.Object obj,
java.lang.String property,
java.lang.Object value)
Set a single property of the bean.
|
static void |
setValues(java.lang.Object obj,
java.util.Map valueMap,
java.lang.String[] allowedProperties)
Set multiple properties of a bean at once using a Map.
|
static void |
setValues(java.lang.Object obj,
java.lang.Object src,
java.lang.String[] allowedProperties)
Set multiple properties of a bean at once using properties of another bean.
|
static void |
setValues(java.lang.Object obj,
javax.servlet.ServletRequest request,
java.lang.String[] allowedProperties)
Set multiple properties of a bean at once using the params passed across
from the ServletRequest (useful for mapping HTML forms to beans).
|
public static final java.lang.String[] getPropertyNames(java.lang.Object obj)
obj
- Object to query for property names.public static final boolean setValue(java.lang.Object obj, java.lang.String property, java.lang.Object value)
obj
- The object to be manipulated.property
- Name of property to set.value
- Value to set property to.public static final java.lang.Object getValue(java.lang.Object obj, java.lang.String property)
obj
- The object to be accessed.property
- Name of property to get.public static final void setValues(java.lang.Object obj, java.util.Map valueMap, java.lang.String[] allowedProperties)
obj
- The object to be manipulated.valueMap
- Map containing property-name (String) / property-value (Object)
pairs to set in the object.allowedProperties
- If array is NOT null, only the properties matching names
passed here shall be set.public static final void setValues(java.lang.Object obj, java.lang.Object src, java.lang.String[] allowedProperties)
obj
- The object to be manipulated.src
- The object containing the properties to be copied.allowedProperties
- If array is NOT null, only the properties matching names
passed here shall be set.public static final void setValues(java.lang.Object obj, javax.servlet.ServletRequest request, java.lang.String[] allowedProperties)
obj
- The object to be manipulated.request
- ServletRequest to get params from.allowedProperties
- If array is NOT null, only the properties matching names
passed here shall be set.public static final java.util.Map getValues(java.lang.Object obj, java.lang.String[] allowedProperties)
obj
- Object to query for properties.allowedProperties
- If array is NOT null, only the properties matching names
passed here shall be retrieved.