org.oddjob.arooa.reflect
Interface PropertyAccessor

All Known Implementing Classes:
BeanUtilsPropertyAccessor

public interface PropertyAccessor

Property access.


Method Summary
 PropertyAccessor accessorWithConversions(ArooaConverter converter)
          Provide an accessor that performs conversions.
 BeanOverview getBeanOverview(Class<?> forClass)
          Provide org.oddjob.arooo.BeanOverview.
 ArooaClass getClassName(Object bean)
          Get the ArooaClass for a bean.
 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 expression, Object value)
          Set a property using a property expression.
 void setSimpleProperty(Object bean, String name, Object value)
          Set a property on a bean.
 

Method Detail

setProperty

void setProperty(Object bean,
                 String expression,
                 Object value)
                 throws ArooaPropertyException
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

void setSimpleProperty(Object bean,
                       String name,
                       Object value)
                       throws ArooaPropertyException
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

ArooaClass getClassName(Object bean)
Get the ArooaClass for a bean.

Parameters:
bean -
Returns:

getBeanOverview

BeanOverview getBeanOverview(Class<?> forClass)
                             throws ArooaException
Provide 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.

Parameters:
forClassCl -
Returns:
Throws:
ArooaException

getProperty

Object getProperty(Object bean,
                   String property)
                   throws ArooaPropertyException
Get a property.

Parameters:
bean - The bean.
The - property.
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.
The - property.
Returns:
The property value.
Throws:
ArooaPropertyException
ArooaConversionException

accessorWithConversions

PropertyAccessor accessorWithConversions(ArooaConverter converter)
Provide an accessor that performs conversions.

Parameters:
converter - The converter.
Returns:
An accessor that performs conversions.