org.springframework.richclient.widget.table
Class NestedAccessor

Show UML class diagram
java.lang.Object
  extended by org.springframework.richclient.widget.table.NestedAccessor
All Implemented Interfaces:
Accessor

public class NestedAccessor
extends Object
implements Accessor

This Accessor uses a chaining implementation of getter methods to allow nested properties.

Since:
0.5.0
Author:
Jan Hoskens

Constructor Summary
NestedAccessor(Class<?> clazz, String propertyName, String nestedPropertyName)
          Convenience constructor.
NestedAccessor(Method getter, String nestedProperty)
          Constructor.
 
Method Summary
 Class<?> getPropertyType()
          Returns the property type of the value that can be obtained through this accessor.
 Object getValue(Object fromEntity)
          Get the value from the source entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NestedAccessor

public NestedAccessor(Class<?> clazz,
                      String propertyName,
                      String nestedPropertyName)
Convenience constructor. Creates a getter method for the given class and property and reroutes to NestedAccessor(Method, String).

Parameters:
clazz - type with the nested property.
propertyName - the first part of the nested property.
nestedPropertyName - the nested property, possibly containing more nesting levels.
See Also:
NestedAccessor(Method, String)

NestedAccessor

public NestedAccessor(Method getter,
                      String nestedProperty)
Constructor. The getter will deliver the first level of the nesting. It's return value will be used to construct the next accessor for the nestedProperty.

Parameters:
getter - method delivering the first part of the nesting.
nestedProperty - property that should be available on the return object of the getter. Possibly nested as well.
See Also:
NestedAccessor(Class, String, String)
Method Detail

getValue

public Object getValue(Object fromEntity)
                throws IllegalAccessException,
                       InvocationTargetException
Get the value from the source entity. If at any point the chaining results in a null value. The chaining should end and return null.

Specified by:
getValue in interface Accessor
Parameters:
fromEntity - the entity on which the getter should operate.
Returns:
null if at any point in the chaining a property returned null or the value of the nested property.
Throws:
IllegalAccessException
InvocationTargetException

getPropertyType

public Class<?> getPropertyType()
Returns the property type of the value that can be obtained through this accessor.

Specified by:
getPropertyType in interface Accessor


Copyright © 2004-2009 The Spring Framework. All Rights Reserved.