Annotation Interface Validate
Performs basic validations against the String representation of the value found in the annotated field.
A validation failure will generate a
DataValidationException
.
By default, nulls and blanks are not allowed.
Commonly used for java beans processed using BeanProcessor
and/or BeanWriterProcessor
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionboolean
Indicates whether this field can be blank (i.e.Ensures that the value of this field matches a given regular expression.String[]
Ensures that the value of this field does is not an unwanted value.boolean
Indicates whether this field can benull
String[]
Ensures that the value of this field is one of a given set of alternativesUser provided implementations ofValidator
which will be executed in sequence after the validations specified in this annotation execute.
-
Element Details
-
nullable
boolean nullableIndicates whether this field can benull
- Returns:
true
true if nulls are allowed,false
otherwise
- Default:
- false
-
allowBlanks
boolean allowBlanksIndicates whether this field can be blank (i.e. contain 0 or more whitespaces, where a whitespace is any character<= ' '
- Returns:
true
true if blanks are allowed,false
otherwise
- Default:
- false
-
matches
String matchesEnsures that the value of this field matches a given regular expression.- Returns:
- the regular expression that determines an expected format for the given value
- Default:
- ""
-
oneOf
String[] oneOfEnsures that the value of this field is one of a given set of alternatives- Returns:
- the sequence of allowed values
- Default:
- {}
-
noneOf
String[] noneOfEnsures that the value of this field does is not an unwanted value.- Returns:
- the sequence of disallowed values
- Default:
- {}
-
validators
User provided implementations ofValidator
which will be executed in sequence after the validations specified in this annotation execute.- Returns:
- custom classes to be used to validate any value associated with this field.
- Default:
- {}
-