public interface Binding

Known subtypesNotifiableBinding

Handle returned by Binders.bind. Lets the caller refresh the components from the model (e.g. after the model was mutated outside the form), re-read the model from the components (e.g. before a save), tear down the listeners installed for two-way bindings, or reach into the Validator the binder configured from the model’s @Required / @Length / @Regex / @Email / @Url / @Numeric / @ExistIn / @Validate annotations.

Methods

public abstract void refresh()Pushes the current model values into every bound component.
public abstract void commit()Pulls current component values back into the model.
public abstract void disconnect()Removes every listener the binder added so the form can be garbage- collected without keeping the model alive.
public abstract Validator getValidator()The Validator populated from the model’s validation annotations.

Method details

refresh

public abstract void refresh()
Pushes the current model values into every bound component.

commit

public abstract void commit()
Pulls current component values back into the model. Useful before validating / submitting a form when none of the bindings is two-way.

disconnect

public abstract void disconnect()
Removes every listener the binder added so the form can be garbage- collected without keeping the model alive.

getValidator

public abstract Validator getValidator()

The Validator populated from the model’s validation annotations.

Each @Bind field that carries one or more of @Required, @Length, @Regex, @Email, @Url, @Numeric, @ExistIn, @Validate contributes a com.codename1.ui.validation.Constraint against the matching component. Multiple annotations on the same field are combined under a GroupConstraint (first failure wins), matching the behaviour of Validator.addConstraint(Component, Constraint...).

The returned validator is never null – call addSubmitButtons to gate a submit Button until every constraint passes, set setValidateOnEveryKey for live feedback, or call isValid() to gate an action programmatically. When the model has no validation annotations the validator is empty and isValid() returns true.