ca.infoway.messagebuilder.j5goodies
Class BeanProperty

Package class diagram package BeanProperty
java.lang.Object
  extended by ca.infoway.messagebuilder.j5goodies.BeanProperty

public class BeanProperty
extends Object

A class to make bean reflection easier.

Author:
Intelliware Development

Method Summary
 Object get()
          Get the property value.
<T extends Annotation>
T
getAnnotation(Class<T> annotationType)
           
 Object getBean()
          Get the bean.
 Class<?> getBeanType()
          Get the type of the property's bean.
 PropertyDescriptor getDescriptor()
          Get the property descriptor.
 String getName()
          Get the property name.
static Map<String,BeanProperty> getProperties(Object bean)
          Get all properties of the bean.
static BeanProperty getProperty(Object bean, String propertyName)
          Get a specific property.
 Class<?> getPropertyType()
          Get the declared type of the property.
 Method getReadMethod()
          Get the read method of the bean property.
 Method getWriteMethod()
          Get the write method of the bean property.
 boolean isCollection()
          Indicates whether or not the property type is a collection.
 boolean isReadable()
          Indicate whether or not the bean is readable.
 boolean isWritable()
          Indicate whether or not the bean is writable.
 void set(Object value)
          Set the property value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getBeanType

public Class<?> getBeanType()

Get the type of the property's bean.

Returns:
- the bean type

getName

public String getName()

Get the property name.

Returns:
- the name

getPropertyType

public Class<?> getPropertyType()

Get the declared type of the property.

Returns:
- the property type

isReadable

public boolean isReadable()

Indicate whether or not the bean is readable.

Returns:
- true is the bean is readable; false otherwise.

isWritable

public boolean isWritable()

Indicate whether or not the bean is writable.

Returns:
- true is the bean is writable; false otherwise.

getReadMethod

public Method getReadMethod()

Get the read method of the bean property.

Returns:
- the read method.

getWriteMethod

public Method getWriteMethod()

Get the write method of the bean property.

Returns:
- the write method.

set

public void set(Object value)

Set the property value.

Parameters:
value - - the new value

get

public Object get()

Get the property value.

Returns:
- the value

getProperties

public static Map<String,BeanProperty> getProperties(Object bean)

Get all properties of the bean.

Parameters:
bean - - the bean to introspect.
Returns:
- a map of all properties, keyed by property name.

getProperty

public static BeanProperty getProperty(Object bean,
                                       String propertyName)

Get a specific property.

Parameters:
bean - - the bean to be introspected.
propertyName - - the name of the property
Returns:
- the property, or null if the property name does not exist.

getDescriptor

public PropertyDescriptor getDescriptor()

Get the property descriptor.

Returns:
- the descriptor.

getBean

public Object getBean()

Get the bean.

Returns:
- the bean.

isCollection

public boolean isCollection()

Indicates whether or not the property type is a collection.

Returns:
- true if the property type is a collection; false otherwise.

getAnnotation

public <T extends Annotation> T getAnnotation(Class<T> annotationType)


Copyright © 2013. All Rights Reserved.