Package com.oorian.data.binding
Class Binding<BEAN,TARGET>
java.lang.Object
com.oorian.data.binding.Binding<BEAN,TARGET>
- Type Parameters:
BEAN- the bean typeTARGET- the bean property type
Represents a binding between a single form field and a bean property.
A binding manages the synchronization of values between an InputElement and
a property on a Java bean. It supports optional type conversion via Converter
and validation via Validator.
Bindings are created through the BindingBuilder fluent API, obtained from
Binder.forField(InputElement) or Binder.forCheckbox(Checkbox).
- Since:
- 2.1
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionInputElement<?> getField()Returns the bound form field.booleanReturns whether the field value has changed since the lastread(Object)call.booleanReturns whether this binding is read-only (no setter).voidPopulates the bound field from the given bean's property value.validate()Validates the current field value against all configured validators.
-
Method Details
-
getField
Returns the bound form field.- Returns:
- the input element
-
isReadOnly
public boolean isReadOnly()Returns whether this binding is read-only (no setter).- Returns:
trueif no setter was provided
-
read
Populates the bound field from the given bean's property value.- Parameters:
bean- the bean to read from
-
validate
Validates the current field value against all configured validators.Checks the required constraint first, then attempts type conversion, then runs all validators on the converted value.
- Returns:
- the validation result
-
isModified
public boolean isModified()Returns whether the field value has changed since the lastread(Object)call.- Returns:
trueif the field value differs from the last read value
-