com.vaadin.data.util.
Class NestedMethodProperty
java.lang.Object
com.vaadin.data.util.AbstractProperty
com.vaadin.data.util.NestedMethodProperty
All Implemented Interfaces:
Property, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeNotifier, Serializable
- extends AbstractProperty
public class NestedMethodProperty
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:
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.ConversionException, Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, 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<?> |
getType()
Returns the type of the Property. |
Object |
getValue()
Gets the value stored in the Property. |
protected void |
invokeSetMethod(Object value)
Internal method to actually call the setter method of the wrapped property. |
boolean |
isReadOnly()
Tests if the Property is in read-only mode. Override for additional restrictions on what is considered a read-only property. |
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)
- Parameters:
instance
- top-level bean to which the property appliespropertyName
- dot separated nested property name- Throws:
IllegalArgumentException
- if the property name is invalid
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".
Method Detail |
---|
getType
public Class<?> getType()
- Returns:
- type of the Property
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
.
isReadOnly
public boolean isReadOnly()
- Specified by:
isReadOnly
in interfaceProperty
- Overrides:
isReadOnly
in classAbstractProperty
- Returns:
true
if the Property is in read-only mode,false
if it's not
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.
getValue
public Object getValue()
- Returns:
- the value of the Property
Gets the value stored in the Property. The value is resolved by calling the specified getter method with the argument specified at instantiation.
setValue
public void setValue(Object newValue)
throws Property.ReadOnlyException,
Property.ConversionException
- Parameters:
newValue
- the New value of the property.- Throws:
- if the object is in read-only mode.Property.ReadOnlyException
- ifProperty.ConversionException
newValue
can't be converted into the Property's native type directly or throughString
.Property.ReadOnlyException
- if the object is in read-only modeProperty.ConversionException
- if newValue can't be converted into the Property's native type directly or through String- See Also:
invokeSetMethod(Object)
Sets the value of the property. This method supports setting from
String
s if either String
is directly assignable
to property type, or the type class contains a string constructor.
invokeSetMethod
protected void invokeSetMethod(Object value)
- Parameters:
value
-
Internal method to actually call the setter method of the wrapped property.
getGetMethods
protected List<Method> getGetMethods()
- Returns:
- unmodifiable list of getter methods corresponding to each segment of the property name
Returns an unmodifiable list of getter methods to call in sequence to get the property value. This API may change in future versions.