BEAN
- the bean typeTARGET
- the target data type of the binding, matches the field type
unless a converter has been setpublic static interface Binder.Binding<BEAN,TARGET> extends Serializable
Binder.forField(HasValue)
Modifier and Type | Method and Description |
---|---|
HasValue<?,?> |
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()
Unbinds the binding from its respective
Binder . |
default BindingValidationStatus<TARGET> |
validate()
Validates the field value and returns a
ValidationStatus
instance representing the outcome of the validation. |
BindingValidationStatus<TARGET> |
validate(boolean fireEvent)
Validates the field value and returns a
ValidationStatus
instance representing the outcome of the validation. |
HasValue<?,?> getField()
default BindingValidationStatus<TARGET> validate()
ValidationStatus
instance representing the outcome of the validation. This method is a
short-hand for calling validate(boolean)
with
fireEvent
true
.validate(boolean)
,
Binder.validate()
,
Validator.apply(Object, ValueContext)
BindingValidationStatus<TARGET> validate(boolean fireEvent)
ValidationStatus
instance representing the outcome of the validation.fireEvent
- true
to fire status event; false
to notvalidate()
BindingValidationStatusHandler getValidationStatusHandler()
void unbind()
Binder
. Removes any
ValueChangeListener
Registration
from associated
HasValue
.void read(BEAN bean)
bean
- the bean to read fromvoid setReadOnly(boolean readOnly)
This helper method is the preferred way to control the read-only state of the bound field.
readOnly
- true
to set binding read-only; false
to
enable writesIllegalStateException
- if trying to make binding read-write and the setter is
null
boolean isReadOnly()
true
if read-only; false
if notsetReadOnly(boolean)
ValueProvider<BEAN,TARGET> getGetter()
Setter<BEAN,TARGET> getSetter()
void setAsRequiredEnabled(boolean asRequiredEnabled)
asRequiredEnabled
- false
if asRequired validator should be disabled,
true
otherwise (default)Binder.BindingBuilder.asRequired(String)
,
Binder.BindingBuilder.asRequired(ErrorMessageProvider)
boolean isAsRequiredEnabled()
false
if asRequired validator is disabled
true
otherwise (default)Binder.BindingBuilder.asRequired(String)
,
Binder.BindingBuilder.asRequired(ErrorMessageProvider)
void setValidatorsDisabled(boolean validatorsDisabled)
validatorsDisabled
- A boolean value.boolean isValidatorsDisabled()
void setConvertBackToPresentation(boolean convertBackToPresentation)
The 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.
convertBackToPresentation
- A boolean valueBinder.BindingBuilder.withConverter(Converter)
,
Binder.BindingBuilder.withConverter(SerializableFunction, SerializableFunction)
,
Binder.BindingBuilder.withConverter(SerializableFunction, SerializableFunction, String)
boolean isConvertBackToPresentation()
Copyright © 2023. All rights reserved.