Package org.oddjob.arooa.reflect
Interface PropertyAccessor
- All Known Implementing Classes:
BeanUtilsPropertyAccessor
public interface PropertyAccessor
Property access.
-
Method Summary
Modifier and TypeMethodDescriptionaccessorWithConversions(ArooaConverter converter) Provide an accessor that performs conversions.getBeanOverview(Class<?> forClass) ProvideBeanOverview.getClassName(Object bean) Get theArooaClassfor a bean.getIndexedProperty(Object bean, String property, int index) Get an indexed property.getMappedProperty(Object bean, String property, String key) Get a property.getProperty(Object bean, String property) Get a property.<T> TgetProperty(Object bean, String property, Class<T> required) Get a property of a required type.getSimpleProperty(Object bean, String property) Get a simple property.voidsetIndexedProperty(Object bean, String name, int index, Object value) Set an indexed property on a bean.voidsetMappedProperty(Object bean, String name, String key, Object value) Set a mapped property on a bean.voidsetProperty(Object bean, String expression, Object value) Set a property using a property expression.voidsetSimpleProperty(Object bean, String name, Object value) Set a property on a bean.
-
Method Details
-
setProperty
Set a property using a property expression.- Parameters:
bean- The bean. Must not be null.expression- The name. Must not be null.value- The value. Can be null.- Throws:
ArooaPropertyException
-
setSimpleProperty
Set a property on a bean.- Parameters:
bean- The bean. Must not be null.name- The name. Must not be null.value- The value. Can be null.- Throws:
ArooaPropertyException
-
setMappedProperty
void setMappedProperty(Object bean, String name, String key, Object value) throws ArooaPropertyException Set a mapped property on a bean.- Parameters:
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.- Throws:
ArooaPropertyException
-
setIndexedProperty
void setIndexedProperty(Object bean, String name, int index, Object value) throws ArooaPropertyException Set an indexed property on a bean.- Parameters:
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.- Throws:
ArooaPropertyException
-
getClassName
Get theArooaClassfor a bean.- Parameters:
bean- The bean.- Returns:
- An Arooa Class
-
getBeanOverview
ProvideBeanOverview. Note that this will provide the overview for the Java class. If using a bean that might be a DynaBean then usegetClassName(Object)and thenArooaClass.getBeanOverview(PropertyAccessor)instead.- Parameters:
forClass- The class to provide the overview for.- Returns:
- An overview. Never null.
- Throws:
ArooaException- If something goes wrong.
-
getProperty
Get a property. The property is a full property expression.- Parameters:
bean- The bean.property- The property expression.- Returns:
- The property value.
- Throws:
ArooaPropertyException
-
getProperty
<T> T getProperty(Object bean, String property, Class<T> required) throws ArooaPropertyException, ArooaConversionException Get a property of a required type.- Parameters:
bean- The bean.property- The property expression.- Returns:
- The property value.
- Throws:
ArooaPropertyExceptionArooaConversionException
-
getSimpleProperty
Get a simple property. A none nested, none indexed, none mapped property.- Parameters:
bean- The bean.property- The property name.- Returns:
- The property value.
- Throws:
ArooaPropertyException
-
getIndexedProperty
Get an indexed property.- Parameters:
bean- The bean.property- The property name.index- The index.- Returns:
- The property value.
- Throws:
ArooaPropertyException
-
getMappedProperty
Get a property. The property is a full property expression.- Parameters:
bean- The bean.property- The property name.key- The key .- Returns:
- The property value.
- Throws:
ArooaPropertyException
-
accessorWithConversions
Provide an accessor that performs conversions.- Parameters:
converter- The converter.- Returns:
- An accessor that performs conversions.
-