BEAN - the bean type, must match the Binder bean typeFIELDVALUE - the value type of the fieldTARGET - the target data type of the binding, matches the field type
unless a converter has been setprotected static class Binder.BindingImpl<BEAN,FIELDVALUE,TARGET> extends Object implements Binder.Binding<BEAN,TARGET>
Binding.| Constructor and Description |
|---|
BindingImpl(Binder.BindingBuilderImpl<BEAN,FIELDVALUE,TARGET> builder,
ValueProvider<BEAN,TARGET> getter,
Setter<BEAN,TARGET> setter) |
| Modifier and Type | Method and Description |
|---|---|
protected ValueContext |
createValueContext()
Creates a value context from the current state of the binding and its
field.
|
protected static Locale |
findLocale()
Finds an appropriate locale to be used in conversion and validation.
|
protected Binder<BEAN> |
getBinder()
Returns the
Binder connected to this Binding
instance. |
HasValue<?,FIELDVALUE> |
getField()
Gets the field the binding uses.
|
ValueProvider<BEAN,TARGET> |
getGetter()
Gets the getter associated with this Binding.
|
Setter<BEAN,TARGET> |
getSetter()
Gets the setter associated with this Binding.
|
BindingValidationStatusHandler |
getValidationStatusHandler()
Gets the validation status handler for this Binding.
|
boolean |
isAsRequiredEnabled()
Returns whether asRequired validator is currently enabled or not.
|
boolean |
isConvertBackToPresentation()
Returns whether the value is converted back to the presentation in
the field when a converter is used in binding.
|
boolean |
isReadOnly()
Gets the current read-only status for this Binding.
|
boolean |
isValidatorsDisabled()
Returns if validators are currently disabled or not.
|
void |
read(BEAN bean)
Reads the value from given item and stores it to the bound field.
|
void |
setAsRequiredEnabled(boolean asRequiredEnabled)
Enable or disable asRequired validator.
|
void |
setConvertBackToPresentation(boolean convertBackToPresentation)
Define whether the value should be converted back to the presentation
in the field when a converter is used in binding.
|
void |
setReadOnly(boolean readOnly)
Sets the read-only status on for this Binding.
|
void |
setValidatorsDisabled(boolean validatorsDisabled)
Define whether validators are disabled or enabled for this specific
binding.
|
void |
unbind()
Removes this binding from its binder and unregisters the
ValueChangeListener from any bound HasValue, and
ValidationStatusChangeListener from any bound
HasValidator. |
BindingValidationStatus<TARGET> |
validate(boolean fireEvent)
Validates the field value and returns a
ValidationStatus
instance representing the outcome of the validation. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvalidatepublic BindingImpl(Binder.BindingBuilderImpl<BEAN,FIELDVALUE,TARGET> builder, ValueProvider<BEAN,TARGET> getter, Setter<BEAN,TARGET> setter)
public HasValue<?,FIELDVALUE> getField()
Binder.BindinggetField in interface Binder.Binding<BEAN,TARGET>protected static Locale findLocale()
public BindingValidationStatus<TARGET> validate(boolean fireEvent)
Binder.BindingValidationStatus
instance representing the outcome of the validation.validate in interface Binder.Binding<BEAN,TARGET>fireEvent - true to fire status event; false to notBinder.Binding.validate()public void unbind()
ValueChangeListener from any bound HasValue, and
ValidationStatusChangeListener from any bound
HasValidator. It does nothing if it is called for an already
unbound binding.unbind in interface Binder.Binding<BEAN,TARGET>protected ValueContext createValueContext()
protected Binder<BEAN> getBinder()
Binder connected to this Binding
instance.public BindingValidationStatusHandler getValidationStatusHandler()
Binder.BindinggetValidationStatusHandler in interface Binder.Binding<BEAN,TARGET>public void read(BEAN bean)
Binder.Bindingread in interface Binder.Binding<BEAN,TARGET>bean - the bean to read frompublic void setReadOnly(boolean readOnly)
Binder.BindingThis helper method is the preferred way to control the read-only state of the bound field.
setReadOnly in interface Binder.Binding<BEAN,TARGET>readOnly - true to set binding read-only; false to
enable writespublic boolean isReadOnly()
Binder.BindingisReadOnly in interface Binder.Binding<BEAN,TARGET>true if read-only; false if notBinder.Binding.setReadOnly(boolean)public ValueProvider<BEAN,TARGET> getGetter()
Binder.BindinggetGetter in interface Binder.Binding<BEAN,TARGET>public Setter<BEAN,TARGET> getSetter()
Binder.BindinggetSetter in interface Binder.Binding<BEAN,TARGET>public void setAsRequiredEnabled(boolean asRequiredEnabled)
Binder.BindingsetAsRequiredEnabled in interface Binder.Binding<BEAN,TARGET>asRequiredEnabled - false if asRequired validator should be disabled,
true otherwise (default)Binder.BindingBuilder.asRequired(String),
Binder.BindingBuilder.asRequired(ErrorMessageProvider)public boolean isAsRequiredEnabled()
Binder.BindingisAsRequiredEnabled in interface Binder.Binding<BEAN,TARGET>false if asRequired validator is disabled
true otherwise (default)Binder.BindingBuilder.asRequired(String),
Binder.BindingBuilder.asRequired(ErrorMessageProvider)public void setValidatorsDisabled(boolean validatorsDisabled)
Binder.BindingsetValidatorsDisabled in interface Binder.Binding<BEAN,TARGET>validatorsDisabled - A boolean value.public boolean isValidatorsDisabled()
Binder.BindingisValidatorsDisabled in interface Binder.Binding<BEAN,TARGET>public void setConvertBackToPresentation(boolean convertBackToPresentation)
Binder.BindingThe default behavior (do not convert back to presentation) changes to the opposite as of Vaadin 19 / Flow 6.0, when a converter is used on a binding and the user input value is modified by the converter, the value from the converter is applied back to the input. It is possible to control this behavior with this API.
setConvertBackToPresentation in interface Binder.Binding<BEAN,TARGET>convertBackToPresentation - A boolean valueBinder.BindingBuilder.withConverter(Converter),
Binder.BindingBuilder.withConverter(SerializableFunction,
SerializableFunction),
Binder.BindingBuilder.withConverter(SerializableFunction,
SerializableFunction, String)public boolean isConvertBackToPresentation()
Binder.BindingisConvertBackToPresentation in interface Binder.Binding<BEAN,TARGET>Copyright © 2025. All rights reserved.