com.vaadin.data.util
Class NestedMethodProperty<T>

java.lang.Object
  extended by com.vaadin.data.util.AbstractProperty<T>
      extended by com.vaadin.data.util.NestedMethodProperty<T>
All Implemented Interfaces:
Property<T>, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeNotifier, Serializable

public class NestedMethodProperty<T>
extends AbstractProperty<T>

Nested accessor based property for a bean. The property is specified in the dotted notation, e.g. "address.street", and can contain multiple levels of nesting. When accessing the property value, all intermediate getters must return non-null values.

Since:
6.6
See Also:
MethodProperty, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.vaadin.data.util.AbstractProperty
AbstractProperty.ReadOnlyStatusChangeEvent
 
Nested classes/interfaces inherited from interface com.vaadin.data.Property
Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer
 
Constructor Summary
NestedMethodProperty(Object instance, String propertyName)
          Constructs a nested method property for a given object instance.
 
Method Summary
protected  List<Method> getGetMethods()
          Returns an unmodifiable list of getter methods to call in sequence to get the property value.
 Class<? extends T> getType()
          Returns the type of the Property.
 T getValue()
          Gets the value stored in the Property.
protected  void invokeSetMethod(T value)
          Internal method to actually call the setter method of the wrapped property.
 boolean isReadOnly()
          Tests if the Property is in read-only mode.
 void setValue(Object newValue)
          Sets the value of the property.
 
Methods inherited from class com.vaadin.data.util.AbstractProperty
addListener, addListener, fireReadOnlyStatusChange, fireValueChange, getListeners, removeListener, removeListener, setReadOnly, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NestedMethodProperty

public NestedMethodProperty(Object instance,
                            String propertyName)
Constructs a nested method property for a given object instance. The property name is a dot separated string pointing to a nested property, e.g. "manager.address.street".

Parameters:
instance - top-level bean to which the property applies
propertyName - dot separated nested property name
Throws:
IllegalArgumentException - if the property name is invalid
Method Detail

getType

public Class<? extends T> getType()
Description copied from interface: Property
Returns the type of the Property. The methods getValue and setValue must be compatible with this type: one must be able to safely cast the value returned from getValue to the given type and pass any variable assignable to this type as an argument to setValue.

Returns:
type of the Property

isReadOnly

public boolean isReadOnly()
Description copied from class: AbstractProperty
Tests if the Property is in read-only mode. In read-only mode calls to the method setValue will throw ReadOnlyException and will not modify the value of the Property. Override for additional restrictions on what is considered a read-only property.

Specified by:
isReadOnly in interface Property<T>
Overrides:
isReadOnly in class AbstractProperty<T>
Returns:
true if the Property is in read-only mode, false if it's not

getValue

public T getValue()
Gets the value stored in the Property. The value is resolved by calling the specified getter method with the argument specified at instantiation.

Returns:
the value of the Property

setValue

public void setValue(Object newValue)
              throws Property.ReadOnlyException
Sets the value of the property. The new value must be assignable to the type of this property.

Parameters:
newValue - the New value of the property.
Throws:
Property.ReadOnlyException - if the object is in read-only mode.
Property.ReadOnlyException - if the object is in read-only mode
See Also:
invokeSetMethod(Object)

invokeSetMethod

protected void invokeSetMethod(T value)
Internal method to actually call the setter method of the wrapped property.

Parameters:
value -

getGetMethods

protected List<Method> getGetMethods()
Returns an unmodifiable list of getter methods to call in sequence to get the property value. This API may change in future versions.

Returns:
unmodifiable list of getter methods corresponding to each segment of the property name


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.