@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.

Methods

public abstract String[] value()The allowed values.
public abstract boolean caseSensitive() default falsetrue to compare values with case-sensitivity.
public abstract String message() default ""Override the default error message (ExistInConstraint derives one from the value list when blank).

Method details

value

public abstract String[] value()
The allowed values. The component must equal one of them.

caseSensitive

public abstract boolean caseSensitive() default false
true to compare values with case-sensitivity. Default: false.

message

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