|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwebwork.util.BeanUtil
JavaBean utility methods
Constructor Summary | |
BeanUtil()
|
Method Summary | |
protected static java.util.Map |
buildFieldMap(java.lang.Class objClass)
Build field map for a class. |
static void |
copy(java.lang.Object from,
java.lang.Object to)
Copy JavaBean property values from one object to another. |
static void |
copy(java.lang.Object from,
java.lang.Object to,
boolean includeNull)
Copy JavaBean property values from one object to another. |
static java.lang.Object |
getAsValue(java.beans.PropertyEditor pe,
java.lang.String txt)
Helper method that gets the value using a PropertyEditor If the editor is a FastPropertyEditor then getAsValue is called otherwise normal setAsText, getValue calls are made |
protected static java.util.Map |
getFieldMapForClass(java.lang.Class objClass)
Get the field map for a class. |
protected static java.beans.PropertyDescriptor |
getPropertyDescriptor(java.lang.String property,
java.lang.Object obj)
Get a property descriptor for a given field on an object |
protected static java.beans.PropertyDescriptor[] |
getPropertyDescriptors(java.lang.Class objClass)
Get property descriptors for a class. |
static java.beans.PropertyEditor |
getPropertyEditor(java.lang.Class clazz)
Helper method to retrieve a property editor out of cache. |
protected static java.beans.PropertyEditor |
getPropertyEditor(java.beans.PropertyDescriptor descriptor)
get The property Editor for the propertyDescriptor. |
protected static boolean |
setIndexedStringValueDirectly(java.lang.Object obj,
java.beans.IndexedPropertyDescriptor descriptor,
java.lang.String[] values,
java.lang.Integer index)
Set a indexed field with a String value directly. |
protected static void |
setIndexedStringValueWithPropertyEditor(java.lang.Object obj,
java.beans.IndexedPropertyDescriptor descriptor,
java.lang.String[] values,
java.lang.Integer index)
Set a indexed field with a String value directly using the Property Editor. |
protected static boolean |
setIndexedValue(java.lang.Object obj,
java.beans.IndexedPropertyDescriptor descriptor,
java.lang.Object val,
java.lang.Integer index)
Set an indexed field. |
static void |
setProperties(java.util.Map from,
java.lang.Object to)
Set JavaBean property values on an object with values taken from a map. |
static void |
setProperty(java.lang.String propertyName,
java.lang.Object val,
java.lang.Object obj)
Set a single JavaBean property value on an object. |
protected static void |
setProperty(java.lang.String propertyName,
java.lang.Object val,
java.lang.Object obj,
java.util.Map fieldMap)
Set a single JavaBean property value on an object. |
protected static boolean |
setStringValueDirectly(java.lang.Object obj,
java.beans.PropertyDescriptor descriptor,
java.lang.String[] values)
Set a non-indexed field with a String value directly. |
protected static void |
setStringValueWithPropertyEditor(java.lang.Object obj,
java.beans.PropertyDescriptor descriptor,
java.lang.String[] values,
java.lang.Class paramClass)
Set a non-indexed field with a String value directly using the Property Editor. |
protected static boolean |
setValue(java.lang.Object obj,
java.beans.PropertyDescriptor descriptor,
java.lang.Object val)
Set a non-indexed field. |
static java.lang.String |
toStringValue(java.lang.Object obj)
Call toString on object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BeanUtil()
Method Detail |
public static void copy(java.lang.Object from, java.lang.Object to) throws java.lang.IllegalArgumentException
from
- the source objectto
- the destination object
java.lang.IllegalArgumentException
- thrown if the copy fails for some reasonpublic static void copy(java.lang.Object from, java.lang.Object to, boolean includeNull) throws java.lang.IllegalArgumentException
from
- the source objectto
- the destination objectincludeNull
- whether null values are copied or not
java.lang.IllegalArgumentException
- thrown if the copy fails for some reasonpublic static void setProperties(java.util.Map from, java.lang.Object to) throws java.lang.IllegalArgumentException
from
- map of valuesto
- the destination object
java.lang.IllegalArgumentException
public static void setProperty(java.lang.String propertyName, java.lang.Object val, java.lang.Object obj) throws java.lang.IllegalArgumentException
propertyName
- String representing the property or subpropertyval
- the value to setobj
- the object to set the property on.
java.lang.IllegalArgumentException
protected static void setProperty(java.lang.String propertyName, java.lang.Object val, java.lang.Object obj, java.util.Map fieldMap) throws java.lang.IllegalArgumentException
propertyName
- String representing the property or subpropertyval
- the value to setobj
- the object to set the property on.fieldMap
- Map with the PropertyDescriptors of the obj
java.lang.IllegalArgumentException
public static java.beans.PropertyEditor getPropertyEditor(java.lang.Class clazz)
public static java.lang.Object getAsValue(java.beans.PropertyEditor pe, java.lang.String txt)
public static java.lang.String toStringValue(java.lang.Object obj)
protected static boolean setValue(java.lang.Object obj, java.beans.PropertyDescriptor descriptor, java.lang.Object val) throws java.lang.IllegalArgumentException
obj
- the object to set the property on.descriptor
- the PropertyDescriptor representing the property to setval
- the value to set
java.lang.IllegalArgumentException
protected static boolean setIndexedValue(java.lang.Object obj, java.beans.IndexedPropertyDescriptor descriptor, java.lang.Object val, java.lang.Integer index)
obj
- the object to set the property on.descriptor
- the PropertyDescriptor representing the property to setval
- the value to setindex
- the index to set it at
java.lang.IllegalArgumentException
protected static boolean setStringValueDirectly(java.lang.Object obj, java.beans.PropertyDescriptor descriptor, java.lang.String[] values) throws java.lang.IllegalArgumentException
obj
- the object we are trying to set it ondescriptor
- PropertyDescriptor representing the firled we want to setvalues
- the String array we are setting
java.lang.IllegalArgumentException
protected static void setStringValueWithPropertyEditor(java.lang.Object obj, java.beans.PropertyDescriptor descriptor, java.lang.String[] values, java.lang.Class paramClass) throws java.lang.IllegalArgumentException
obj
- the object we are trying to set it ondescriptor
- PropertyDescriptor representing the firled we want to setvalues
- the String array we are settingparamClass
- The parameter class used in the write method. Passed in for efficiency.
java.lang.IllegalArgumentException
protected static void setIndexedStringValueWithPropertyEditor(java.lang.Object obj, java.beans.IndexedPropertyDescriptor descriptor, java.lang.String[] values, java.lang.Integer index) throws java.lang.IllegalArgumentException
obj
- the object we are trying to set it ondescriptor
- PropertyDescriptor representing the firled we want to setvalues
- the String array we are settingindex
- the index that we want to set
java.lang.IllegalArgumentException
protected static boolean setIndexedStringValueDirectly(java.lang.Object obj, java.beans.IndexedPropertyDescriptor descriptor, java.lang.String[] values, java.lang.Integer index) throws java.lang.IllegalArgumentException
obj
- the object we are trying to set it ondescriptor
- PropertyDescriptor representing the firled we want to setvalues
- the String array we are settingindex
- the index that we want to set
java.lang.IllegalArgumentException
protected static java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String property, java.lang.Object obj)
property
- the property that we are interested inobj
- the object we want the property descriptor forprotected static java.util.Map getFieldMapForClass(java.lang.Class objClass)
objClass
- the object we want to build the field map forprotected static java.util.Map buildFieldMap(java.lang.Class objClass)
objClass
- the object we want to build the field map for
protected static java.beans.PropertyEditor getPropertyEditor(java.beans.PropertyDescriptor descriptor)
descriptor
- PropertyDescriptor
protected static java.beans.PropertyDescriptor[] getPropertyDescriptors(java.lang.Class objClass)
objClass
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |