public class BeanUtilsPropertyAccessor extends Object implements PropertyAccessor
Constructor and Description |
---|
BeanUtilsPropertyAccessor() |
Modifier and Type | Method and Description |
---|---|
PropertyAccessor |
accessorWithConversions(ArooaConverter converter)
Provide an accessor that performs conversions.
|
void |
clear() |
BeanOverview |
getBeanOverview(Class<?> forClass)
Provide
org.oddjob.arooo.BeanOverview . |
ArooaClass |
getClassName(Object bean)
Get the
ArooaClass for a bean. |
ArooaConverter |
getConverter() |
Object |
getProperty(Object bean,
String property)
Get a property.
|
<T> T |
getProperty(Object bean,
String property,
Class<T> required)
Get a property of a required type.
|
void |
setIndexedProperty(Object bean,
String name,
int index,
Object value)
Set an indexed property on a bean.
|
void |
setMappedProperty(Object bean,
String name,
String key,
Object value)
Set a mapped property on a bean.
|
void |
setProperty(Object bean,
String name,
Object value)
Set a property on a bean.
|
void |
setSimpleProperty(Object bean,
String name,
Object value)
Set a property on a bean.
|
static void |
validateSimplePropertyName(String name) |
public PropertyAccessor accessorWithConversions(ArooaConverter converter)
PropertyAccessor
accessorWithConversions
in interface PropertyAccessor
converter
- The converter.public ArooaConverter getConverter()
public void setProperty(Object bean, String name, Object value) throws ArooaPropertyException
setProperty
in interface PropertyAccessor
bean
- The bean. Must not be null.name
- The name. Must not be null.value
- The value. Can be null.ArooaPropertyException
public void setSimpleProperty(Object bean, String name, Object value) throws ArooaPropertyException
setSimpleProperty
in interface PropertyAccessor
bean
- The bean. Must not be null.name
- The name. Must not be null.value
- The value. Can be null.ArooaPropertyException
public void setMappedProperty(Object bean, String name, String key, Object value) throws ArooaPropertyException
setMappedProperty
in interface PropertyAccessor
bean
- The bean. Must not be null.name
- The name. Must not be null.key
- The mapped property's key. Must not be null.value
- The value. Can be null.PropertyAccessException
ArooaPropertyException
public void setIndexedProperty(Object bean, String name, int index, Object value) throws ArooaPropertyException
setIndexedProperty
in interface PropertyAccessor
bean
- The bean. Must not be null.name
- The name. Must not be null.index
- The indexed property's index. 0 based.value
- The value. Can be null.ArooaPropertyException
public Object getProperty(Object bean, String property) throws ArooaPropertyException
getProperty
in interface PropertyAccessor
bean
- The bean.The
- property.ArooaPropertyException
public <T> T getProperty(Object bean, String property, Class<T> required) throws ArooaPropertyException, ArooaConversionException
getProperty
in interface PropertyAccessor
bean
- The bean.The
- property.ArooaPropertyException
ArooaConversionException
public static void validateSimplePropertyName(String name) throws IllegalArgumentException
IllegalArgumentException
public ArooaClass getClassName(Object bean)
PropertyAccessor
ArooaClass
for a bean.getClassName
in interface PropertyAccessor
public BeanOverview getBeanOverview(Class<?> forClass) throws ArooaException
PropertyAccessor
org.oddjob.arooo.BeanOverview
. Note that this
will provide the overview for the Java class. If using a bean
that might be a dynabean then use
getArooaClass(bean).getBeanOverview()
instead.getBeanOverview
in interface PropertyAccessor
ArooaException
public void clear()