Enum Class ErrorCode
- All Implemented Interfaces:
Serializable,Comparable<ErrorCode>,Constable
Error codes for known common validation constraint violations.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionGeneric invalid value error code.A field that should be null (or not be present) is not null.Required field not present.Required field is empty (null or empty string, map, collection...).Required field (string) is empty or does not contain, at least, one non-blank character.Error code for a field that must be a number whose value must be lower or equal to the specified maximum.Error code for a field that must be a number whose value must be higher or equal to the specified maximum.Error code for a field that must be in a specific range.Error code for a field that must be a number whose value must be lower or equal to the specified maximum.Error code for a field that must be a number whose value must be higher or equal to the specified maximum.Error code for a field that must be between the specified boundaries (included).Error code for a field that must be an instant, date or time in the future.Error code for a field that must be an instant, date or time in the present or future.Error code for a field that must be an instant, date or time in the past.Error code for a field that must be an instant, date or time in the past.Error code for a field that must be a well-formed email address.Error code for a field which value should match a regular expression. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Class<? extends Annotation>The constratingAnnotationfor the given error code. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateErrorCode(Class<? extends Annotation> constraint) Enumeration entry constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Annotation>
ErrorCodeforConstraint(T constraint) Get the corresponding error code for a constraint violation.static ErrorCodeReturns the enum constant of this class with the specified name.static ErrorCode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
V4000000
Generic invalid value error code. -
V4000001
A field that should be null (or not be present) is not null. SeeNull. -
V4000002
Required field not present. SeeNull. SeeNotNull. -
V4000003
Required field is empty (null or empty string, map, collection...). SeeNotEmpty. -
V4000004
Required field (string) is empty or does not contain, at least, one non-blank character. SeeNotBlank. -
V4000005
Error code for a field that must be a number whose value must be lower or equal to the specified maximum. SeeDecimalMax. -
V4000006
Error code for a field that must be a number whose value must be higher or equal to the specified maximum. SeeDecimalMin. -
V4000007
Error code for a field that must be in a specific range. SeeDigits. -
V4000008
Error code for a field that must be a number whose value must be lower or equal to the specified maximum. SeeMax. -
V4000009
Error code for a field that must be a number whose value must be higher or equal to the specified maximum. SeeMin. -
V4000010
Error code for a field that must be between the specified boundaries (included). SeeSize. -
V4000011
Error code for a field that must be an instant, date or time in the future. SeeFuture. -
V4000012
Error code for a field that must be an instant, date or time in the present or future. SeeFutureOrPresent. -
V4000013
Error code for a field that must be an instant, date or time in the past. SeePast. -
V4000014
Error code for a field that must be an instant, date or time in the past. SeePast. -
V4000015
Error code for a field that must be a well-formed email address. SeeEmail. -
V4000016
Error code for a field which value should match a regular expression. SeePattern.
-
-
Field Details
-
constraint
The constratingAnnotationfor the given error code.
-
-
Constructor Details
-
ErrorCode
Enumeration entry constructor.- Parameters:
constraint- the constratingAnnotationfor the given error code.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
forConstraint
Get the corresponding error code for a constraint violation.- Type Parameters:
T- the constraint annotation type.- Parameters:
constraint- the violated constraint.- Returns:
- the corresponding error code for the given constraint. If not found,
V4000000will be returnes.
-