@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 | caseSensitiveMatch the value in case sensitive manner, default true | 
| String | caseSensitiveExpressionAllows specify caseSensitive as an expression which will be evaluated during validation | 
| String | fieldName | 
| String | key | 
| String | message | 
| String[] | messageParams | 
| String | regexRegex used to evaluate field against it | 
| String | regexExpressionDefines regex as an expression which first will be evaluated against the Value Stack to get proper regex. | 
| boolean | shortCircuitIf this is activated, the validator will be used as short-circuit. | 
| boolean | trimTo trim or not the value, default true - trim | 
| String | trimExpressionAllows 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–2025 Apache Software Foundation. All rights reserved.