org.xwiki.properties.internal
Class DefaultBeanDescriptor

java.lang.Object
  extended by org.xwiki.properties.internal.DefaultBeanDescriptor
All Implemented Interfaces:
BeanDescriptor

public class DefaultBeanDescriptor
extends Object
implements BeanDescriptor

Default implementation for BeanDescriptor.

Since:
2.0M2
Version:
$Id$

Constructor Summary
DefaultBeanDescriptor(Class<?> beanClass)
           
 
Method Summary
protected  void extractBeanDescriptor()
          Extract informations form the bean.
protected
<T extends Annotation>
T
extractPropertyAnnotation(Method writeMethod, Method readMethod, Class<T> annotationClass)
          Get the parameter annotation.
protected  void extractPropertyDescriptor(Field field, Object defaultInstance)
          Extract provided properties informations and insert it in parameterDescriptorMap.
protected  void extractPropertyDescriptor(PropertyDescriptor propertyDescriptor, Object defaultInstance)
          Extract provided properties information and insert it in parameterDescriptorMap.
 Class<?> getBeanClass()
          
 Collection<PropertyDescriptor> getProperties()
          
 PropertyDescriptor getProperty(String propertyName)
          Return descriptor for the provided property name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultBeanDescriptor

public DefaultBeanDescriptor(Class<?> beanClass)
Parameters:
beanClass - the class of the JAVA bean.
Method Detail

extractBeanDescriptor

protected void extractBeanDescriptor()
Extract informations form the bean.


extractPropertyDescriptor

protected void extractPropertyDescriptor(PropertyDescriptor propertyDescriptor,
                                         Object defaultInstance)
Extract provided properties information and insert it in parameterDescriptorMap.

Parameters:
propertyDescriptor - the JAVA bean property descriptor.
defaultInstance - the default instance of bean class.

extractPropertyDescriptor

protected void extractPropertyDescriptor(Field field,
                                         Object defaultInstance)
Extract provided properties informations and insert it in parameterDescriptorMap.

Parameters:
field - the JAVA bean property descriptor.
defaultInstance - the default instance of bean class.

extractPropertyAnnotation

protected <T extends Annotation> T extractPropertyAnnotation(Method writeMethod,
                                                             Method readMethod,
                                                             Class<T> annotationClass)
Get the parameter annotation. Try first on the setter then on the getter if no annotation has been found.

Type Parameters:
T - the Class object corresponding to the annotation type.
Parameters:
writeMethod - the method that should be used to write the property value.
readMethod - the method that should be used to read the property value.
annotationClass - the Class object corresponding to the annotation type.
Returns:
this element's annotation for the specified annotation type if present on this element, else null.

getBeanClass

public Class<?> getBeanClass()

Specified by:
getBeanClass in interface BeanDescriptor
Returns:
the class of the JAVA bean containing.
See Also:
BeanDescriptor.getBeanClass()

getProperties

public Collection<PropertyDescriptor> getProperties()

Specified by:
getProperties in interface BeanDescriptor
Returns:
the properties of the java bean.
See Also:
BeanDescriptor.getProperties()

getProperty

public PropertyDescriptor getProperty(String propertyName)
Return descriptor for the provided property name. The property name is case sensitive.

Specified by:
getProperty in interface BeanDescriptor
Parameters:
propertyName - the name of the property
Returns:
the descriptor of the property.
See Also:
BeanDescriptor.getProperty(java.lang.String)


Copyright © 2004-2011 XWiki. All Rights Reserved.