-
@Documented @Retention(SOURCE) @Target({FIELD,METHOD,PARAMETER}) @ConstraintRule(supportedTypes={java.lang.String.class,java.lang.Character.class}, validatorClass={EnumerationStringConstraintValidator.class,EnumerationCharacterConstraintValidator.class}) @SelfDocumented public @interface Enumeration
The annotated element must be an element of the predefined enumeration.This validation rule is useful when java enum type is not applicable. For example if enum value equals to java keyword. The following enum couldn't be compiled, because 'new' is java keyword
enum OrderType { new, // compile error old }
To solve this issue use @Enumeration annotation, otherwise use Java enum.
- Author:
- nedis
-
-
Element Detail
-
value
String[] value
- Returns:
- enum string values
-
-