public class PropertyUtils extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
clearCache()
Clears all cached information.
|
static void |
configureProperties(java.lang.Object target,
java.lang.String initializer)
Initializes the properties of an object from a string.
|
static PropertyAdaptor |
getPropertyAdaptor(java.lang.Object target,
java.lang.String propertyName)
Returns the
PropertyAdaptor for the given target object and property name. |
static java.lang.Class |
getPropertyType(java.lang.Object target,
java.lang.String propertyName)
Returns the type of the named property.
|
static java.util.List |
getReadableProperties(java.lang.Object target)
Returns an unordered List of the names of all readable properties of the target.
|
static java.util.List |
getWriteableProperties(java.lang.Object target)
Returns an unordered List of the names of all writable properties of the target.
|
static boolean |
isReadable(java.lang.Object target,
java.lang.String propertyName) |
static boolean |
isWritable(java.lang.Object target,
java.lang.String propertyName)
Returns true of the instance contains a writable property of the given type.
|
static java.lang.Object |
read(java.lang.Object target,
java.lang.String propertyName)
Updates the property of the target object.
|
static void |
smartWrite(java.lang.Object target,
java.lang.String propertyName,
java.lang.String value)
An improved version of
write(Object, String, Object) where the value starts as a
string and is converted to the correct property type before being assigned. |
static void |
write(java.lang.Object target,
java.lang.String propertyName,
java.lang.Object value)
Updates the property of the target object.
|
public static void write(java.lang.Object target, java.lang.String propertyName, java.lang.Object value)
target
- the object to updatepropertyName
- the name of the property to be updatedvalue
- the value to be stored into the target object propertypublic static void smartWrite(java.lang.Object target, java.lang.String propertyName, java.lang.String value)
write(Object, String, Object)
where the value starts as a
string and is converted to the correct property type before being assigned.public static void configureProperties(java.lang.Object target, java.lang.String initializer)
validate,maxLength=10,displayName=User Id
.target
- the object to be configuredinitializer
- the string encoding the properties and values to be configured in the target
objectpublic static boolean isWritable(java.lang.Object target, java.lang.String propertyName)
target
- the object to inspectpropertyName
- the name of the property to checkpublic static boolean isReadable(java.lang.Object target, java.lang.String propertyName)
public static java.lang.Object read(java.lang.Object target, java.lang.String propertyName)
target
- the object to updatepropertyName
- the name of a property toreadpublic static java.lang.Class getPropertyType(java.lang.Object target, java.lang.String propertyName)
target
- the object to examinepropertyName
- the name of the property to checkpublic static PropertyAdaptor getPropertyAdaptor(java.lang.Object target, java.lang.String propertyName)
PropertyAdaptor
for the given target object and property name.ApplicationRuntimeException
- if the property does not exist.public static java.util.List getReadableProperties(java.lang.Object target)
public static java.util.List getWriteableProperties(java.lang.Object target)
public static void clearCache()
Introspector.flushCaches()
.