com.vaadin.flow.data.binder.
Interface Binder.Binding<BEAN,TARGET>
-
Type Parameters:
BEAN
- the bean typeTARGET
- the target data type of the binding, matches the field type unless a converter has been setAll Superinterfaces:
All Known Implementing Classes:
public static interface Binder.Binding<BEAN,TARGET> extends Serializable
Represents the binding between a field and a data property.
See Also:
-
-
Method Summary
All Methods 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
isReadOnly()
Gets the current read-only status for this Binding.
void
read(BEAN bean)
Reads the value from given item and stores it to the bound field.
void
setReadOnly(boolean readOnly)
Sets the read-only status on for this 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.
-
-
-
Method Detail
-
getField
HasValue<?,?> getField()
Gets the field the binding uses.
Returns:
the field for the binding
-
validate
default BindingValidationStatus<TARGET> validate()
Validates the field value and returns a
ValidationStatus
instance representing the outcome of the validation. This method is a short-hand for callingvalidate(boolean)
withfireEvent
true
.Returns:
the validation result.
See Also:
validate(boolean)
,Binder.validate()
,Validator.apply(Object, ValueContext)
-
validate
BindingValidationStatus<TARGET> validate(boolean fireEvent)
Validates the field value and returns a
ValidationStatus
instance representing the outcome of the validation.Parameters:
fireEvent
-true
to fire status event;false
to notReturns:
the validation result.
See Also:
-
getValidationStatusHandler
BindingValidationStatusHandler getValidationStatusHandler()
Gets the validation status handler for this Binding.
Returns:
the validation status handler for this binding
-
unbind
void unbind()
Unbinds the binding from its respective
Binder
. Removes anyValueChangeListener
Registration
from associatedHasValue
.
-
read
void read(BEAN bean)
Reads the value from given item and stores it to the bound field.
Parameters:
bean
- the bean to read from
-
setReadOnly
void setReadOnly(boolean readOnly)
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.
Parameters:
readOnly
-true
to set binding read-only;false
to enable writesThrows:
IllegalStateException
- if trying to make binding read-write and the setter isnull
-
isReadOnly
boolean isReadOnly()
Gets the current read-only status for this Binding.
Returns:
true
if read-only;false
if notSee Also:
-
getGetter
ValueProvider<BEAN,TARGET> getGetter()
Gets the getter associated with this Binding.
Returns:
the getter
-
-