-
@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 keywordenum OrderType { new, // compile error old }To solve this issue use @
Enumerationannotation, otherwise use Java enum.- Since:
- 0.1
- Author:
- nedis
- See Also:
Enum,SubEnum,EnumerationStringConstraintValidator,EnumerationCharacterConstraintValidator
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description booleanoffAllows disabling the validation rule if this rule is inherited from super class.
-
-
-
Element Detail
-
value
String[] value
Returns the enum string values.- Returns:
- the enum string values
-
-