You're viewing an older version of Vaadin JavaDoc. Please see version 24.7.0 for the latest.
com.vaadin.flow.function.

Interface ValueProvider<SOURCE,​TARGET>

  • Type Parameters:

    SOURCE - the type of the object used to provide the value

    TARGET - the type of the provided value

    All Superinterfaces:

    Function<SOURCE,​TARGET>, Serializable, SerializableFunction<SOURCE,​TARGET>

    All Known Subinterfaces:

    IdentifierProvider<T>

    Functional Interface:

    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface ValueProvider<SOURCE,​TARGET>
    extends SerializableFunction<SOURCE,​TARGET>

    A callback interface for providing values from a given source.

    For example this interface can be implemented to simply extract a value with a getter, or to create a composite value based on the fields of the source object.

    Since:

    1.0.

    Author:

    Vaadin Ltd

    • Method Summary

      All Methods
      Modifier and Type Method Description
      TARGET apply​(SOURCE source)

      Provides a value from the given source object.

      static <T> ValueProvider<T,​T> identity()

      Returns a value provider that always returns its input argument.

    • Method Detail

      • identity

        static <T> ValueProvider<T,​T> identity()

        Returns a value provider that always returns its input argument.

        Type Parameters:

        T - the type of the input and output objects to the function

        Returns:

        a function that always returns its input argument

      • apply

        TARGET apply​(SOURCE source)

        Provides a value from the given source object.

        Specified by:

        apply in interface Function<SOURCE,​TARGET>

        Parameters:

        source - the source to retrieve the value from

        Returns:

        the value provided by the source