com.vaadin.data.util.

Class PropertyValueGenerator<T>

  • Type Parameters:

    T - Property data type

    All Implemented Interfaces:

    Serializable

    public abstract class PropertyValueGenerator<T>
    extends Object
    implements Serializable

    PropertyValueGenerator for GeneratedPropertyContainer.

    Since:

    7.4

    Author:

    Vaadin Ltd

    See Also:

    Serialized Form

    • Constructor Detail

      • PropertyValueGenerator

        public PropertyValueGenerator()
    • Method Detail

      • getValue

        public abstract T getValue​(Item item,
                                   Object itemId,
                                   Object propertyId)

        Returns value for given Item. Used by GeneratedPropertyContainer when generating new properties.

        Parameters:

        item - currently handled item

        itemId - item id for currently handled item

        propertyId - id for this property

        Returns:

        generated value

      • getType

        public abstract Class<T> getType()

        Return Property type for this generator. This function is called when Property.getType() is called for generated property.

        Returns:

        type of generated property

      • getSortProperties

        public SortOrder[] getSortProperties​(SortOrder order)

        Translates sorting of the generated property in a specific direction to a set of property ids and directions in the underlying container.

        SortOrder is similar to (or the same as) the SortOrder already defined for Grid.

        The default implementation of this method returns an empty array, which means that the property will not be included in getSortableContainerPropertyIds(). Attempting to sort by that column throws UnsupportedOperationException. Returning null is not allowed.

        Parameters:

        order - a sort order for this property

        Returns:

        an array of sort orders describing how this property is sorted

      • modifyFilter

        public Container.Filter modifyFilter​(Container.Filter filter)
                                      throws UnsupportedFilterException

        Return an updated filter that should be compatible with the underlying container.

        This function is called when setting a filter for this generated property. Returning null from this function causes GeneratedPropertyContainer to discard the filter and not use it.

        By default this function throws UnsupportedFilterException.

        Parameters:

        filter - original filter for this property

        Returns:

        modified filter that is compatible with the underlying container

        Throws:

        UnsupportedFilterException - if the implementation doesn't support modifying the provided filter