com.vaadin.data.util.

Class ObjectProperty<T>

    • Constructor Detail

      • ObjectProperty

        public ObjectProperty​(T value)

        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

        public ObjectProperty​(T value,
                              Class<T> type)

        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

        public ObjectProperty​(T value,
                              Class<T> type,
                              boolean readOnly)

        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, see ObjectProperty(Object, Class).

        Parameters:

        value - the Initial value of the property.

        type - the type of the value. value must be assignable to this type.

        readOnly - Sets the read-only mode.

    • Method Detail

      • getType

        public final Class<T> getType()

        Returns the type of the ObjectProperty. 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

      • getValue

        public T getValue()

        Gets the value stored in the Property.

        Returns:

        the value stored in the Property

      • setValue

        public void setValue​(T newValue)
                      throws Property.ReadOnlyException

        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