01: package org.caramba.validator;
02:
03: import org.caramba.CarambaConstants;
04:
05: import static java.lang.annotation.ElementType.FIELD;
06: import java.lang.annotation.Retention;
07: import static java.lang.annotation.RetentionPolicy.RUNTIME;
08: import java.lang.annotation.Target;
09:
10: /**
11: * Add this annotation to your field, which contains Validatable Component. It will add the {@link RequiredValidator}
12: * the component's ValidatorSet.
13: *
14: * @author Pieter Degraeuwe
15: */
16: @Target({FIELD})
17: @Retention(RUNTIME)
18: public @interface Required {
19: /**
20: * @return the message key, used to construct the error message. defaults to "errors.required"
21: */
22: String messageKey() default "errors.required";
23:
24: String fieldNameKey() default "";
25:
26: String errorsId() default CarambaConstants.GLOBALERRORS;
27: // ValidationTrigger trigger() default ValidationTrigger.ALWAYS;
28:
29: }
|