Package com.vaadin.featurepack.data.util
Class ObjectProperty<T>
java.lang.Object
com.vaadin.featurepack.data.util.AbstractProperty<T>
com.vaadin.featurepack.data.util.ObjectProperty<T>
- All Implemented Interfaces:
Property<T>,Property.ReadOnlyStatusChangeNotifier,Property.ValueChangeNotifier,Serializable
A simple data object containing one typed value. This class is a
straightforward implementation of the the
Property interface.- Since:
- 3.0
- Author:
- Vaadin Ltd.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.featurepack.data.util.AbstractProperty
AbstractProperty.ReadOnlyStatusChangeEventNested classes/interfaces inherited from interface com.vaadin.featurepack.data.Property
Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer -
Constructor Summary
ConstructorsConstructorDescriptionObjectProperty(T value) Creates a new instance of ObjectProperty with the given value.ObjectProperty(T value, Class<T> type) Creates a new instance of ObjectProperty with the given value and type.ObjectProperty(T value, Class<T> type, boolean readOnly) Creates a new instance of ObjectProperty with the given value, type and read-only mode status. -
Method Summary
Methods inherited from class com.vaadin.featurepack.data.util.AbstractProperty
addReadOnlyStatusChangeListener, addValueChangeListener, fireReadOnlyStatusChange, fireValueChange, getListeners, isPropertyReadOnly, removeReadOnlyStatusChangeListener, removeValueChangeListener, setPropertyReadOnly
-
Constructor Details
-
ObjectProperty
Creates a new instance of ObjectProperty with the given value. The type of the property is automatically initialized to be the type of the given value.- Parameters:
value- the Initial value of the Property.
-
ObjectProperty
Creates a new instance of ObjectProperty with the given value and type. Since Vaadin 7, only values of the correct type are accepted, and no automatic conversions are performed.- Parameters:
value- the Initial value of the Property.type- the type of the value. The value must be assignable to given type.
-
ObjectProperty
Creates a new instance of ObjectProperty with the given value, type and read-only mode status. Since Vaadin 7, only the correct type of values is accepted, seeObjectProperty(Object, Class).- Parameters:
value- the Initial value of the property.type- the type of the value.valuemust be assignable to this type.readOnly- Sets the read-only mode.
-
-
Method Details
-
getType
Returns the type of the ObjectProperty. The methodsgetValueandsetValuemust be compatible with this type: one must be able to safely cast the value returned fromgetValueto the given type and pass any variable assignable to this type as an argument tosetValue.- Returns:
- type of the Property
-
getValue
Gets the value stored in the Property.- Returns:
- the value stored in the Property
-
setValue
Sets the value of the property. Note that since Vaadin 7, no conversions are performed and the value must be of the correct type.- Parameters:
newValue- the New value of the property.- Throws:
Property.ReadOnlyException- if the object is in read-only mode
-