atg.beans
Class BeanPropertyMapper

java.lang.Object
  extended by atg.beans.BeanPropertyMapper
All Implemented Interfaces:
DynamicPropertyMapper

public class BeanPropertyMapper
extends java.lang.Object
implements DynamicPropertyMapper

Implementation of DynamicPropertyMapper that works off of a bean's regular compile-time properties as discovered by introspection. Is used to cache a set of property descriptors for non-dynamic beans for efficient retrieval, but can also be useful in the implementation of DynamicPropertyMappers that expose a combination of dynamic and compile-time properties.


Field Summary
static java.lang.String CLASS_VERSION
           
 
Constructor Summary
BeanPropertyMapper(java.lang.Class pClass)
           
 
Method Summary
 DynamicBeanInfo getBeanInfo(java.lang.Object pBean)
          Gets a DynamicBeanInfo that describes the given dynamic bean.
protected  java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String pPropertyName)
          Get a PropertyDescriptor for some property, in a case-insensitive matter.
 java.lang.Object getPropertyValue(java.lang.Object pBean, java.lang.String pPropertyName)
          Gets the value of the dynamic property from the specified object.
static java.lang.reflect.Method getPublicMethod(java.lang.reflect.Method pMethod)
          Returns a publicly-accessible version of the given method, by searching for a public declaring class.
protected  boolean isBeanProperty(java.lang.String pPropertyName)
          Use this method in a subclass to determine whether or not the specified property name is a regular bean property (i.e.
 void setPropertyValue(java.lang.Object pBean, java.lang.String pPropertyName, java.lang.Object pValue)
          Sets the value of the dynamic property from the specified object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Constructor Detail

BeanPropertyMapper

public BeanPropertyMapper(java.lang.Class pClass)
Method Detail

isBeanProperty

protected boolean isBeanProperty(java.lang.String pPropertyName)
Use this method in a subclass to determine whether or not the specified property name is a regular bean property (i.e. not a dynamic property).

Returns:
true if the name passed in is a bean property.

getPropertyDescriptor

protected java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String pPropertyName)
Get a PropertyDescriptor for some property, in a case-insensitive matter. We store properties initially under their lowercased name and then cache the same properties under equivalent, alternate names as they crop up.

Parameters:
pPropertyName - the name of the property
Returns:
the sought-after PropertyDescriptor, or null if not found

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.Object pBean,
                                         java.lang.String pPropertyName)
                                  throws PropertyNotFoundException
Gets the value of the dynamic property from the specified object.

Specified by:
getPropertyValue in interface DynamicPropertyMapper
Throws:
PropertyNotFoundException

setPropertyValue

public void setPropertyValue(java.lang.Object pBean,
                             java.lang.String pPropertyName,
                             java.lang.Object pValue)
                      throws PropertyNotFoundException
Sets the value of the dynamic property from the specified object.

Specified by:
setPropertyValue in interface DynamicPropertyMapper
Throws:
PropertyNotFoundException

getBeanInfo

public DynamicBeanInfo getBeanInfo(java.lang.Object pBean)
                            throws java.beans.IntrospectionException
Gets a DynamicBeanInfo that describes the given dynamic bean.

Specified by:
getBeanInfo in interface DynamicPropertyMapper
Returns:
the DynamicBeanInfo describing the bean.
Throws:
java.beans.IntrospectionException - if no information is available.

getPublicMethod

public static java.lang.reflect.Method getPublicMethod(java.lang.reflect.Method pMethod)
Returns a publicly-accessible version of the given method, by searching for a public declaring class.