|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.stellent.cis.common.bean.BeanUtil
public class BeanUtil
Generic utility methods for working with bean objects
Field Summary | |
---|---|
static java.lang.String |
BOOLEAN_FALSE
|
static java.lang.String |
BOOLEAN_NO
|
static java.lang.String |
BOOLEAN_OFF
|
static java.lang.String |
BOOLEAN_ON
|
static java.lang.String |
BOOLEAN_TRUE
|
static java.lang.String |
BOOLEAN_YES
|
protected static java.lang.String |
CREATE_OBJECT
|
static java.lang.String |
DOT_SIGN
Package/Class Name separator |
protected static java.lang.String |
GET_CLASS
|
protected static java.lang.String |
NEW_INSTANCE
|
Constructor Summary | |
---|---|
BeanUtil()
|
Method Summary | |
---|---|
static boolean |
equal(java.lang.Object obj1,
java.lang.Object obj2)
Simply compares two objects using equals() method and takes care about nulls null == null = false |
static java.lang.Object |
getPrivilegedProperty(java.lang.Object instance,
java.lang.String propertyName)
Retrieves a privilged property |
static java.beans.PropertyDescriptor |
getPropertyDescriptor(java.lang.Object anInstance,
java.lang.String aPropertyName)
Returns property descriptor of the selected property for the selected object instance. |
static java.beans.PropertyDescriptor[] |
getPropertyDescriptors(java.lang.Class instanceClass)
Returns property descriptor list for a given object class selected object instance. |
static java.lang.Class |
loadClass(java.lang.String className)
|
static java.lang.Class |
loadClass(java.lang.String className,
java.lang.ClassLoader classLoader)
|
static byte[] |
save(java.lang.Object object)
Serialize an object to an array of bytes. |
static void |
setProperties(java.lang.Object anInstance,
java.util.Map propertyValues)
|
static void |
setProperty(java.lang.Object anInstance,
java.lang.String aPropertyName,
java.lang.Object aValue)
Set's a particular property of the instance Usage:
SomeBean bean = new SomeBean();
Integer propertyValue = new Integer(10);
ClassTools.setProperty(bean, "propertyName", propertyValue);
is in fact equal to
bean.setPropertyValue(propertyValue);
Simple types are also supported
int propertyValue = 10;
ClassTools.setProperty(bean, "intPropertyName", new Integer(propertyValue));
|
static boolean |
setPropertyByString(java.lang.Object anInstance,
java.lang.String aPropertyName,
java.lang.String aStringValue)
Set's a particular property of the instance by string value Usage: SomeBean bean = new SomeBean(); ObjectUtil.setPropertyByString(bean, "someProperty", "10"); |
static boolean |
setSpecialProperty(java.lang.Object instance,
java.lang.String propName,
java.lang.Object value)
Sets a "special" property, i.e. |
static java.lang.Object |
StringToValue(java.lang.String s,
java.lang.Class t)
Converts String value to the type specified by class |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DOT_SIGN
public static final java.lang.String BOOLEAN_TRUE
public static final java.lang.String BOOLEAN_FALSE
public static final java.lang.String BOOLEAN_YES
public static final java.lang.String BOOLEAN_NO
public static final java.lang.String BOOLEAN_ON
public static final java.lang.String BOOLEAN_OFF
protected static final java.lang.String CREATE_OBJECT
protected static final java.lang.String GET_CLASS
protected static final java.lang.String NEW_INSTANCE
Constructor Detail |
---|
public BeanUtil()
Method Detail |
---|
public static java.lang.Object StringToValue(java.lang.String s, java.lang.Class t)
public static java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.Object anInstance, java.lang.String aPropertyName)
anInstance
- public static java.beans.PropertyDescriptor[] getPropertyDescriptors(java.lang.Class instanceClass)
instanceClass
-
public static void setProperty(java.lang.Object anInstance, java.lang.String aPropertyName, java.lang.Object aValue)
SomeBean bean = new SomeBean();
Integer propertyValue = new Integer(10);
ClassTools.setProperty(bean, "propertyName", propertyValue);
is in fact equal to
bean.setPropertyValue(propertyValue);
Simple types are also supported
int propertyValue = 10;
ClassTools.setProperty(bean, "intPropertyName", new Integer(propertyValue));
public static boolean setPropertyByString(java.lang.Object anInstance, java.lang.String aPropertyName, java.lang.String aStringValue)
public static boolean setSpecialProperty(java.lang.Object instance, java.lang.String propName, java.lang.Object value)
setSpecialProperty (instance, "value(name)", "charles") -> calls instance.setValue ("name", "charles") setSpecialProperty (instance, "value[1]", "charles") -> calls instance.setValue ("charles", 1)
instance
- propName
- value
-
public static void setProperties(java.lang.Object anInstance, java.util.Map propertyValues)
public static boolean equal(java.lang.Object obj1, java.lang.Object obj2)
public static byte[] save(java.lang.Object object)
object
- the object to serialize. Must implement Serializable
public static java.lang.Object getPrivilegedProperty(java.lang.Object instance, java.lang.String propertyName) throws java.lang.IllegalAccessException
java.lang.IllegalAccessException
public static java.lang.Class loadClass(java.lang.String className) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public static java.lang.Class loadClass(java.lang.String className, java.lang.ClassLoader classLoader) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |