public class BeanPropertyMapper extends java.lang.Object implements DynamicPropertyMapper, atg.beans.AnnotationDynamicPropertyMapper
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.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CLASS_VERSION |
| Constructor and Description |
|---|
BeanPropertyMapper(java.lang.Class pClass) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.annotation.Annotation |
getAnnotation(java.lang.Object pBean,
java.lang.String pPropertyName,
java.lang.Class pAnnotationClass)
Gets a particular type of annotation, if it exists, for a property on a
bean.
|
java.util.Set<java.lang.annotation.Annotation> |
getAnnotations(java.lang.Object pBean,
java.lang.String pPropertyName)
Gets all of the annotations for a property on a bean.
|
DynamicBeanInfo |
getBeanInfo(java.lang.Object pBean)
Gets a DynamicBeanInfo that describes the given dynamic bean.
|
java.util.Set<java.lang.String> |
getPropertiesWithAnnotation(java.lang.Object pBean,
java.lang.Class pAnnotationClass)
Gets a set of property names that have a particular annotation.
|
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.
|
java.lang.String |
getPropertyWithAnnotation(java.lang.Object pBean,
java.lang.Class pAnnotationClass)
Gets a property name for a property on a bean that has a particular
annotation.
|
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.
|
protected boolean isBeanProperty(java.lang.String pPropertyName)
protected java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String pPropertyName)
pPropertyName - the name of the propertypublic java.lang.Object getPropertyValue(java.lang.Object pBean,
java.lang.String pPropertyName)
throws PropertyNotFoundException
getPropertyValue in interface DynamicPropertyMapperPropertyNotFoundExceptionpublic void setPropertyValue(java.lang.Object pBean,
java.lang.String pPropertyName,
java.lang.Object pValue)
throws PropertyNotFoundException
setPropertyValue in interface DynamicPropertyMapperPropertyNotFoundExceptionpublic DynamicBeanInfo getBeanInfo(java.lang.Object pBean) throws java.beans.IntrospectionException
getBeanInfo in interface DynamicPropertyMapperjava.beans.IntrospectionException - if no information is available.public static java.lang.reflect.Method getPublicMethod(java.lang.reflect.Method pMethod)
public java.util.Set<java.lang.annotation.Annotation> getAnnotations(java.lang.Object pBean,
java.lang.String pPropertyName)
throws java.beans.IntrospectionException
getAnnotations in interface atg.beans.AnnotationDynamicPropertyMapperpBean - The objectpPropertyName - The property namejava.beans.IntrospectionException - Thrown if there is a problem retrieving the
annotations from the classpublic java.lang.annotation.Annotation getAnnotation(java.lang.Object pBean,
java.lang.String pPropertyName,
java.lang.Class pAnnotationClass)
throws java.beans.IntrospectionException
getAnnotation in interface atg.beans.AnnotationDynamicPropertyMapperpBean - The objectpPropertyName - The property namepAnnotationClass - The type of annotationjava.beans.IntrospectionException - Thrown if there is a problem retrieving the
annotation from the classpublic java.lang.String getPropertyWithAnnotation(java.lang.Object pBean,
java.lang.Class pAnnotationClass)
throws java.beans.IntrospectionException
getPropertyWithAnnotation in interface atg.beans.AnnotationDynamicPropertyMapperpBean - The objectpAnnotationClass - The type of annotationjava.beans.IntrospectionException - Thrown if there is a problem retrieving the
annotation from the classpublic java.util.Set<java.lang.String> getPropertiesWithAnnotation(java.lang.Object pBean,
java.lang.Class pAnnotationClass)
throws java.beans.IntrospectionException
getPropertiesWithAnnotation in interface atg.beans.AnnotationDynamicPropertyMapperpBean - The objectpAnnotationClass - The type of annotationjava.beans.IntrospectionException - Thrown if there is a problem retrieving the
annotation from the class