Class 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:
    Serialized Form
    • Constructor Detail

      • ValueContext

        public ValueContext()
        Constructor for ValueContext without a Locale.
      • ValueContext

        public ValueContext​(Locale locale)
        Constructor for ValueContext without a Component.
        Parameters:
        locale - The locale used with conversion. Can be null.
      • ValueContext

        public ValueContext​(Component component)
        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

        public ValueContext​(Component component,
                            HasValue<?,​?> hasValue)
        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

        public ValueContext​(Component component,
                            HasValue<?,​?> hasValue,
                            Locale locale)
        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 Detail

      • 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