@Retention(CLASS) @Target({FIELD})

public @interface Validate

Escape hatch for the validation annotation set: points the component at a hand-written com.codename1.ui.validation.Constraint implementation. The referenced class must be public and expose a public no-argument constructor; the generated binder calls new YourConstraint() at bind time and registers it against the Validator exposed via Binding#getValidator().

public final class PhoneConstraint implements Constraint {
    public boolean isValid(Object value) { ... }
    public String getDefaultFailMessage() { return "Bad phone number"; }
}

@Bind(name="phoneField") @Validate(PhoneConstraint.class)
private String phone;

Stacks with the canned annotations – @Required @Validate(MyExtra.class) composes them under a single GroupConstraint (first failure wins). Use it when the built-ins aren’t enough; reach for the canned annotations first.

Methods

public abstract Class<?> value()The Constraint implementation to instantiate.

Method details

value

public abstract Class<?> value()
The Constraint implementation to instantiate. Must have a public no-argument constructor.