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 |
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 |
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 static Locale findLocale()
public BindingValidationStatus<TARGET> validate(boolean fireEvent)
Binder.Binding
ValidationStatus
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
. 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)Binder.BindingBuilder.asRequired(String)
,
Binder.BindingBuilder.asRequired(ErrorMessageProvider)
public boolean isAsRequiredEnabled()
Binder.Binding
isAsRequiredEnabled
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.Binding
setValidatorsDisabled
in interface Binder.Binding<BEAN,TARGET>
validatorsDisabled
- A boolean value.public boolean isValidatorsDisabled()
Binder.Binding
isValidatorsDisabled
in interface Binder.Binding<BEAN,TARGET>
Copyright © 2020. All rights reserved.