org.yajul.util
Class PropertyAccessors

java.lang.Object
  extended by org.yajul.util.PropertyAccessors

public class PropertyAccessors
extends java.lang.Object

Encapsulates the getter and setter meta-data for a given property.


Constructor Summary
PropertyAccessors(BeanProperties beanProperties, java.lang.String name)
          Creates a new group of accessor methods for the given property name.
 
Method Summary
 java.lang.reflect.Method getGetter()
          Returns the getter method.
 java.lang.String getName()
          Returns the name of the property.
 java.lang.reflect.Method getSetter()
          Returns the setter method.
 java.lang.Class getType()
          Returns the type of the property.
 java.lang.Object invokeGetter(java.lang.Object bean)
          Invokes the getter on the specified object, returning the property value.
 java.lang.Object invokeSetter(java.lang.Object bean, java.lang.Object value)
          Invokes the setter on the given bean using the given value.
 java.lang.Object invokeSetter(java.lang.Object bean, java.lang.Object value, java.text.Format format)
          Invokes the setter on the given bean using the given value.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyAccessors

public PropertyAccessors(BeanProperties beanProperties,
                         java.lang.String name)
Creates a new group of accessor methods for the given property name.

Parameters:
name - The property name.
Method Detail

getName

public java.lang.String getName()
Returns the name of the property.

Returns:
the name of the property.

getType

public java.lang.Class getType()
Returns the type of the property.

Returns:
the type of the property.

getGetter

public java.lang.reflect.Method getGetter()
Returns the getter method.

Returns:
the getter method.

getSetter

public java.lang.reflect.Method getSetter()
Returns the setter method.

Returns:
the setter method.

invokeSetter

public java.lang.Object invokeSetter(java.lang.Object bean,
                                     java.lang.Object value)
                              throws java.lang.IllegalAccessException,
                                     java.lang.reflect.InvocationTargetException,
                                     java.lang.NoSuchMethodException,
                                     java.text.ParseException
Invokes the setter on the given bean using the given value.

Parameters:
bean - The bean to set the property on.
value - The new value of the property.
Returns:
The new value of the property
Throws:
java.lang.IllegalAccessException - if the setter cannot be accessed
java.lang.reflect.InvocationTargetException - if the setter cannot be accessed
java.lang.NoSuchMethodException - if the setter cannot be accessed
java.text.ParseException - if the value needed to be parsed, and could not be

invokeSetter

public java.lang.Object invokeSetter(java.lang.Object bean,
                                     java.lang.Object value,
                                     java.text.Format format)
                              throws java.lang.IllegalAccessException,
                                     java.lang.reflect.InvocationTargetException,
                                     java.lang.NoSuchMethodException,
                                     java.text.ParseException
Invokes the setter on the given bean using the given value.

Parameters:
bean - The bean to set the property on.
value - The new value of the property.
format - The format that will be used to convert the value into the property type.
Returns:
The new value of the property
Throws:
java.lang.IllegalAccessException - if the setter cannot be accessed
java.lang.reflect.InvocationTargetException - if the setter cannot be accessed
java.lang.NoSuchMethodException - if the setter cannot be accessed
java.text.ParseException - if the value needed to be parsed, and could not be

invokeGetter

public java.lang.Object invokeGetter(java.lang.Object bean)
                              throws java.lang.IllegalAccessException,
                                     java.lang.reflect.InvocationTargetException,
                                     java.lang.NoSuchMethodException
Invokes the getter on the specified object, returning the property value.

Parameters:
bean - The bean to invoke the getter on.
Returns:
The property value.
Throws:
java.lang.IllegalAccessException - if the getter cannot be accessed
java.lang.reflect.InvocationTargetException - if the getter cannot be accessed
java.lang.NoSuchMethodException - if the getter cannot be accessed

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2008. All Rights Reserved.