Annotation Type ExistIn


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

Requires the component value to be one of an allowed list of strings. The processor emits com.codename1.ui.validation.ExistInConstraint(value, caseSensitive, message) into the Validator returned by Binding#getValidator().

@Bind(name="roleField") @ExistIn({"admin", "editor", "viewer"})
private String role;

Use it to gate free-text fields that should accept only a known vocabulary, or to gate Picker selections against an authoritative list known at compile time.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The allowed values.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    true to compare values with case-sensitivity.
    Override the default error message (ExistInConstraint derives one from the value list when blank).
  • Element Details

    • value

      String[] value
      The allowed values. The component must equal one of them.
    • caseSensitive

      boolean caseSensitive
      true to compare values with case-sensitivity. Default: false.
      Default:
      false
    • message

      String message
      Override the default error message (ExistInConstraint derives one from the value list when blank).
      Default:
      ""