Class Binding<BEAN,TARGET>

java.lang.Object
com.oorian.data.binding.Binding<BEAN,TARGET>
Type Parameters:
BEAN - the bean type
TARGET - the bean property type

public class Binding<BEAN,TARGET> extends Object
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 Details

    • getField

      public InputElement<?> getField()
      Returns the bound form field.
      Returns:
      the input element
    • isReadOnly

      public boolean isReadOnly()
      Returns whether this binding is read-only (no setter).
      Returns:
      true if no setter was provided
    • read

      public void read(BEAN bean)
      Populates the bound field from the given bean's property value.
      Parameters:
      bean - the bean to read from
    • validate

      public ValidationResult 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 last read(Object) call.
      Returns:
      true if the field value differs from the last read value