@Retention(CLASS) @Target({FIELD})
public @interface Required
Marks a @Bind field whose component must hold a non-empty value. The
binder generated by the Codename One Maven plugin installs a
com.codename1.ui.validation.LengthConstraint(1) on the matching component
and wires it into the Validator returned by Binding#getValidator().
@Bindable
public class SignupModel {
@Bind(name="userField") @Required
private String user;
}
Stack with other validation annotations – the constraints are combined
(AND) via Validator.addConstraint(Component, Constraint...). The first
failing constraint’s message is shown.
Methods
public abstract String message() default "" | Override the default error message (“A value is required”). |
Method details
message
public abstract String message() default ""Override the default error message (“A value is required”).