Annotation Type Length


@Retention(CLASS) @Target(FIELD) public @interface Length

Requires the component value to have at least min characters. The processor wires this into the Validator returned by Binding#getValidator() as a com.codename1.ui.validation.LengthConstraint(min, message).

@Bindable
public class SignupModel {
    @Bind(name="passwordField") @Length(min = 8)
    private String password;
}
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    int
    Minimum number of characters.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Override the default error message ("Input must be at least <min> characters").
  • Element Details

    • min

      int min
      Minimum number of characters. Use 1 for "non-empty" -- or just write @Required which is shorter and reads better.
    • message

      String message
      Override the default error message ("Input must be at least <min> characters").
      Default:
      ""