com.vaadin.flow.data.binder.

Class ValueContext

java.lang.Object
com.vaadin.flow.data.binder.ValueContext

All Implemented Interfaces:

Serializable

public class ValueContext extends Object implements Serializable

Value context for Converters. Contains relevant information for converting values.

Since:

1.0.

Author:

Vaadin Ltd

See Also:

  • Constructor Details

    • ValueContext

      public ValueContext(Binder<?> binder)

      Constructor for ValueContext without a Locale.

      Parameters:

      binder - the Binder using the value context

    • ValueContext

      public ValueContext(Binder binder, Locale locale)

      Constructor for ValueContext without a Component.

      Parameters:

      binder - the Binder using the value context

      locale - The locale used with conversion. Can be null.

    • ValueContext

      public ValueContext(Binder binder, Component component)

      Constructor for ValueContext.

      Parameters:

      binder - the Binder using the value context

      component - The component related to current value. Can be null. If the component implements HasValue, it will be returned by getHasValue() as well.

    • ValueContext

      public ValueContext(Binder binder, Component component, HasValue<?,?> hasValue)

      Constructor for ValueContext.

      Parameters:

      binder - the Binder using the value context

      component - The component related to current value. Can be null.

      hasValue - The value source related to current value. Can be null.

    • ValueContext

      public ValueContext(Binder binder, Component component, HasValue<?,?> hasValue, Locale locale)

      Constructor for ValueContext.

      Parameters:

      binder - the Binder using the value context

      component - The component can be null.

      locale - The locale used with conversion. Can be null.

      hasValue - The value source related to current value. Can be null.

    • ValueContext

      @Deprecated public ValueContext()
      Deprecated.
      Use the version with binder reference instead

      Constructor for ValueContext without a Locale.

    • ValueContext

      @Deprecated public ValueContext(Locale locale)
      Deprecated.
      Use the version with binder reference instead

      Constructor for ValueContext without a Component.

      Parameters:

      locale - The locale used with conversion. Can be null.

    • ValueContext

      @Deprecated public ValueContext(Component component)
      Deprecated.
      Use the version with binder reference instead

      Constructor for ValueContext.

      Parameters:

      component - The component related to current value. Can be null. If the component implements HasValue, it will be returned by getHasValue() as well.

    • ValueContext

      @Deprecated public ValueContext(Component component, HasValue<?,?> hasValue)
      Deprecated.
      Use the version with binder reference instead

      Constructor for ValueContext.

      Parameters:

      component - The component related to current value. Can be null.

      hasValue - The value source related to current value. Can be null.

    • ValueContext

      @Deprecated public ValueContext(Component component, HasValue<?,?> hasValue, Locale locale)
      Deprecated.
      Use the version with binder reference instead

      Constructor for ValueContext.

      Parameters:

      component - The component can be null.

      locale - The locale used with conversion. Can be null.

      hasValue - The value source related to current value. Can be null.

  • Method Details

    • getComponent

      public Optional<Component> getComponent()

      Returns an Optional for the Component related to value conversion.

      Returns:

      the optional of component

    • getLocale

      public Optional<Locale> getLocale()

      Returns an Optional for the Locale used in the value conversion.

      Returns:

      the optional of locale

    • getHasValue

      public Optional<HasValue<?,?>> getHasValue()

      Returns an Optional for the HasValue used in the value conversion. In certain complicated cases, ex. cross-field validation, HasValue might be not available.

      Returns:

      the optional of HasValue

    • getBinder

      public Optional<Binder<?>> getBinder()

      Returns an Optional for the Binder owning this value context.

      Returns:

      the optional of Binder