Class ValueContext

  • All Implemented Interfaces:
    java.io.Serializable

    public class ValueContext
    extends java.lang.Object
    implements java.io.Serializable
    Value context for Converters. Contains relevant information for converting values.
    Since:
    8.0
    Author:
    Vaadin Ltd.
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<Component> getComponent()
      Returns an Optional for the Component related to value conversion.
      java.util.Optional<HasValue<?>> getHasValue()
      Returns an Optional for the HasValue used in the value conversion.
      java.util.Optional<java.util.Locale> getLocale()
      Returns an Optional for the Locale used in the value conversion.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ValueContext

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

        public ValueContext​(java.util.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.
        Since:
        8.1
      • ValueContext

        public ValueContext​(Component component,
                            HasValue<?> hasValue,
                            java.util.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.
        Since:
        8.1
    • Method Detail

      • getComponent

        public java.util.Optional<Component> getComponent()
        Returns an Optional for the Component related to value conversion.
        Returns:
        the optional of component
      • getLocale

        public java.util.Optional<java.util.Locale> getLocale()
        Returns an Optional for the Locale used in the value conversion.
        Returns:
        the optional of locale
      • getHasValue

        public java.util.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
        Since:
        8.1