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 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 . |
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, wait
validate
public BindingImpl(Binder.BindingBuilderImpl<BEAN,FIELDVALUE,TARGET> builder, ValueProvider<BEAN,TARGET> getter, Setter<BEAN,TARGET> setter)
public HasValue<FIELDVALUE> getField()
Binder.Binding
getField
in interface Binder.Binding<BEAN,TARGET>
protected Locale findLocale()
public BindingValidationStatus<TARGET> validate(boolean fireEvent)
Binder.Binding
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.validate
in interface Binder.Binding<BEAN,TARGET>
fireEvent
- true
to fire status event; false
to notBinder.Binding.validate()
,
Binder.validate()
public void unbind()
ValueChangeListener
from any bound HasValue
. 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.Binding
getValidationStatusHandler
in interface Binder.Binding<BEAN,TARGET>
public void read(BEAN bean)
Binder.Binding
read
in interface Binder.Binding<BEAN,TARGET>
bean
- the bean to read frompublic void setReadOnly(boolean readOnly)
Binder.Binding
This 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.Binding
isReadOnly
in interface Binder.Binding<BEAN,TARGET>
true
if read-only; false
if notBinder.Binding.setReadOnly(boolean)
public ValueProvider<BEAN,TARGET> getGetter()
Binder.Binding
getGetter
in interface Binder.Binding<BEAN,TARGET>
public Setter<BEAN,TARGET> getSetter()
Binder.Binding
getSetter
in interface Binder.Binding<BEAN,TARGET>
public void setAsRequiredEnabled(boolean asRequiredEnabled)
Binder.Binding
setAsRequiredEnabled
in interface Binder.Binding<BEAN,TARGET>
asRequiredEnabled
- false
if asRequired validator should be disabled,
true
otherwise (default)#asRequired(String)
,
#asRequired(ErrorMessageProvider)
public boolean isAsRequiredEnabled()
Binder.Binding
isAsRequiredEnabled
in interface Binder.Binding<BEAN,TARGET>
false
if asRequired validator is disabled
true
otherwise (default)#asRequired(String)
,
#asRequired(ErrorMessageProvider)
public void setValidatorsDisabled(boolean validatorsDisabled)
Binder.Binding
setValidatorsDisabled
in interface Binder.Binding<BEAN,TARGET>
validatorsDisabled
- A boolean valuepublic boolean isValidatorsDisabled()
Binder.Binding
isValidatorsDisabled
in interface Binder.Binding<BEAN,TARGET>
public void setConvertBackToPresentation(boolean convertBackToPresentation)
Binder.Binding
setConvertBackToPresentation
in interface Binder.Binding<BEAN,TARGET>
convertBackToPresentation
- A boolean valuepublic boolean isConvertBackToPresentation()
Binder.Binding
isConvertBackToPresentation
in interface Binder.Binding<BEAN,TARGET>
Copyright © 2022 Vaadin Ltd. All rights reserved.