com.vaadin.data.

Class Binder.BindingImpl<BEAN,FIELDVALUE,TARGET>

  • Type Parameters:

    BEAN - the bean type, must match the Binder bean type

    FIELDVALUE - the value type of the field

    TARGET - the target data type of the binding, matches the field type unless a converter has been set

    All Implemented Interfaces:

    Binder.Binding<BEAN,TARGET>, Serializable

    Enclosing class:

    Binder<BEAN>


    protected static class Binder.BindingImpl<BEAN,FIELDVALUE,TARGET>
    extends Object
    implements Binder.Binding<BEAN,TARGET>

    An internal implementation of Binding.

    See Also:

    Serialized Form

    • Method Detail

      • findLocale

        protected Locale findLocale()

        Finds an appropriate locale to be used in conversion and validation.

        Returns:

        the found locale, not null

      • validate

        public BindingValidationStatus<TARGET> validate(boolean fireEvent)

        Description copied from interface: Binder.Binding

        Validates the field value and returns a ValidationStatus instance representing the outcome of the validation. Note: Calling this method will not trigger the value update in the bean automatically. This method will attempt to temporarily apply all current changes to the bean and run full bean validation for it. The changes are reverted after bean validation.

        Specified by:

        validate in interface Binder.Binding<BEAN,TARGET>

        Parameters:

        fireEvent - true to fire status event; false to not

        Returns:

        the validation result.

        See Also:

        Binder.Binding.validate(), Binder.validate()

      • unbind

        public void unbind()

        Removes this binding from its binder and unregisters the ValueChangeListener from any bound HasValue. It does nothing if it is called for an already unbound binding.

        Specified by:

        unbind in interface Binder.Binding<BEAN,TARGET>

        Since:

        8.2

      • createValueContext

        protected ValueContext createValueContext()

        Creates a value context from the current state of the binding and its field.

        Returns:

        the value context

      • getBinder

        protected Binder<BEAN> getBinder()

        Returns the Binder connected to this Binding instance.

        Returns:

        the binder

      • read

        public void read(BEAN bean)

        Description copied from interface: Binder.Binding

        Reads the value from given item and stores it to the bound field.

        Specified by:

        read in interface Binder.Binding<BEAN,TARGET>

        Parameters:

        bean - the bean to read from

      • setReadOnly

        public void setReadOnly(boolean readOnly)

        Description copied from interface: Binder.Binding

        Sets the read-only status on for this Binding. Setting a Binding read-only will mark the field read-only and not write any values from the fields to the bean.

        This helper method is the preferred way to control the read-only state of the bound field.

        Specified by:

        setReadOnly in interface Binder.Binding<BEAN,TARGET>

        Parameters:

        readOnly - true to set binding read-only; false to enable writes

      • setAsRequiredEnabled

        public void setAsRequiredEnabled(boolean asRequiredEnabled)

        Description copied from interface: Binder.Binding

        Enable or disable asRequired validator. The validator is enabled by default.

        Specified by:

        setAsRequiredEnabled in interface Binder.Binding<BEAN,TARGET>

        Parameters:

        asRequiredEnabled - false if asRequired validator should be disabled, true otherwise (default)

        See Also:

        #asRequired(String), #asRequired(ErrorMessageProvider)

      • isAsRequiredEnabled

        public boolean isAsRequiredEnabled()

        Description copied from interface: Binder.Binding

        Returns whether asRequired validator is currently enabled or not.

        Specified by:

        isAsRequiredEnabled in interface Binder.Binding<BEAN,TARGET>

        Returns:

        false if asRequired validator is disabled true otherwise (default)

        See Also:

        #asRequired(String), #asRequired(ErrorMessageProvider)

      • setValidatorsDisabled

        public void setValidatorsDisabled(boolean validatorsDisabled)

        Description copied from interface: Binder.Binding

        Define whether validators are disabled or enabled for this specific binding.

        Specified by:

        setValidatorsDisabled in interface Binder.Binding<BEAN,TARGET>

        Parameters:

        validatorsDisabled - A boolean value

      • setConvertBackToPresentation

        public void setConvertBackToPresentation(boolean convertBackToPresentation)

        Description copied from interface: Binder.Binding

        Define whether the value should be converted back to the presentation in the field when a converter is used in binding.

        Specified by:

        setConvertBackToPresentation in interface Binder.Binding<BEAN,TARGET>

        Parameters:

        convertBackToPresentation - A boolean value

      • isConvertBackToPresentation

        public boolean isConvertBackToPresentation()

        Description copied from interface: Binder.Binding

        Returns whether the value is converted back to the presentation in the field when a converter is used in binding.

        Specified by:

        isConvertBackToPresentation in interface Binder.Binding<BEAN,TARGET>

        Returns:

        A boolean value