@Target(value=METHOD) @Retention(value=RUNTIME) public @interface RegexFieldValidator
Annotation usage:
The annotation must be applied at method level.
Annotation parameters:
Parameter | Required | Default | Notes |
---|---|---|---|
message | yes | field error message | |
key | no | i18n key from language specific properties file. | |
messageParams | no | Additional params to be used to customize message - will be evaluated against the Value Stack | |
fieldName | no | ||
shortCircuit | no | false | If this validator should be used as shortCircuit. |
type | yes | ValidatorType.FIELD | Enum value from ValidatorType. Either FIELD or SIMPLE can be used here. |
regex | yes | The regex to validate the field value against. |
Example code:
@RegexFieldValidator( key = "regex.field", regex = "yourregexp")
Modifier and Type | Optional Element and Description |
---|---|
boolean |
caseSensitive
Match the value in case sensitive manner, default true
|
String |
caseSensitiveExpression
Allows specify caseSensitive as an expression which will be evaluated during validation
|
String |
fieldName |
String |
key |
String |
message |
String[] |
messageParams |
String |
regex
Regex used to evaluate field against it
|
String |
regexExpression
Defines regex as an expression which first will be evaluated against the Value Stack to get proper regex.
|
boolean |
shortCircuit
If this is activated, the validator will be used as short-circuit.
|
boolean |
trim
To trim or not the value, default true - trim
|
String |
trimExpression
Allows specify trim as an expression which will be evaluated during validation
|
ValidatorType |
type |
public abstract String message
public abstract String[] messageParams
public abstract String key
public abstract String fieldName
public abstract String regex
public abstract String regexExpression
public abstract boolean trim
public abstract String trimExpression
public abstract boolean caseSensitive
public abstract String caseSensitiveExpression
public abstract boolean shortCircuit
public abstract ValidatorType type
Copyright © 2000–2020 Apache Software Foundation. All rights reserved.