org.springframework.richclient.widget.table
Class NestedWriter

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

public class NestedWriter
extends Object
implements Writer

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

Since:
0.5.0
Author:
Jan Hoskens

Constructor Summary
NestedWriter(Class<?> clazz, String propertyName, String nestedPropertyName)
          Convenience constructor.
NestedWriter(Method getter, String nestedPropertyName)
          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.
 void setValue(Object toEntity, Object newValue)
          Set the value on the source entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NestedWriter

public NestedWriter(Class<?> clazz,
                    String propertyName,
                    String nestedPropertyName)
Convenience constructor. Creates a getter method for the given class and property and reroutes to NestedWriter(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. Only the last one in the line needs the setter method.
See Also:
NestedWriter(Method, String)

NestedWriter

public NestedWriter(Method getter,
                    String nestedPropertyName)
Constructor. The given getter should yield the return value on which the nested property exists.

Parameters:
getter - the method providing the entity.
nestedPropertyName - the nested property on the entity.
Method Detail

setValue

public void setValue(Object toEntity,
                     Object newValue)
              throws IllegalAccessException,
                     InvocationTargetException
Set the value on the source entity. If at any point the chaining results in a null value. The chaining should end.

Specified by:
setValue in interface Writer
Parameters:
toEntity - the entity on which the getter should operate.
newValue - the value to set.
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

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


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