org.oddjob.arooa.reflect
Class BeanUtilsBeanHelper

java.lang.Object
  extended byorg.oddjob.arooa.reflect.BeanUtilsBeanHelper

public class BeanUtilsBeanHelper
extends java.lang.Object

BeanUtilsBean with bespoke conversion and ArooaExceptions.


Constructor Summary
BeanUtilsBeanHelper(org.apache.commons.beanutils.BeanUtilsBean bub)
          Constructor which takes a BeanUtilsBean to wrap.
BeanUtilsBeanHelper(org.apache.commons.beanutils.BeanUtilsBean bub, java.lang.String tag, Location location)
          Constructor which takes a BeanUtilsBean and tag and location for exceptions.
 
Method Summary
 java.lang.Object convert(java.lang.Class required, java.lang.Object from)
          Resolve a given object into an oject of the required class.
 java.lang.Object getProperty(java.lang.Object bean, java.lang.String property)
          Get a property.
 java.lang.Object getProperty(java.lang.Object bean, java.lang.String property, java.lang.Class required)
          Get a property of a required type.
 java.lang.Class getPropertyType(java.lang.Object bean, java.lang.String name)
          Get the property type.
 void setMappedProperty(java.lang.Object bean, java.lang.String name, java.lang.String key, java.lang.Object value)
          Set a mapped property on a bean.
 void setProperty(java.lang.Object bean, java.lang.String name, java.lang.Object value)
          Set a property on a bean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanUtilsBeanHelper

public BeanUtilsBeanHelper(org.apache.commons.beanutils.BeanUtilsBean bub,
                           java.lang.String tag,
                           Location location)
Constructor which takes a BeanUtilsBean and tag and location for exceptions.

Parameters:
bub - The BeanUtilsBean.
tag - The tag.
location - The location.

BeanUtilsBeanHelper

public BeanUtilsBeanHelper(org.apache.commons.beanutils.BeanUtilsBean bub)
Constructor which takes a BeanUtilsBean to wrap.

Parameters:
bub -
Method Detail

setProperty

public void setProperty(java.lang.Object bean,
                        java.lang.String name,
                        java.lang.Object value)
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.

setMappedProperty

public void setMappedProperty(java.lang.Object bean,
                              java.lang.String name,
                              java.lang.String key,
                              java.lang.Object value)
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.

getPropertyType

public java.lang.Class getPropertyType(java.lang.Object bean,
                                       java.lang.String name)
Get the property type.

Parameters:
bean -
name -
Returns:

getProperty

public java.lang.Object getProperty(java.lang.Object bean,
                                    java.lang.String property)
Get a property.

Parameters:
bean - The bean.
Returns:
The property value.

getProperty

public java.lang.Object getProperty(java.lang.Object bean,
                                    java.lang.String property,
                                    java.lang.Class required)
Get a property of a required type.

Parameters:
bean - The bean.
Returns:
The property value.

convert

public java.lang.Object convert(java.lang.Class required,
                                java.lang.Object from)
                         throws java.lang.ClassCastException
Resolve a given object into an oject of the required class.

Parameters:
from - The object to resolve from.
required - The required class;
Returns:
A resolved object or null if the from object was null;
Throws:
java.lang.ClassCastException - if no resolution is possible.