@Target(value={METHOD,TYPE}) @Retention(value=RUNTIME) public @interface CustomValidator
Annotation usage:
The annotation must be applied at method or type 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 | name of validator | Simple string which identifies that validator among other | 
Example code:
@CustomValidator(type ="customValidatorName", fieldName = "myField")
| Modifier and Type | Required Element and Description | 
|---|---|
| String | type | 
| Modifier and Type | Optional Element and Description | 
|---|---|
| String | fieldName | 
| String | key | 
| String | message | 
| String[] | messageParams | 
| ValidationParameter[] | parameters | 
| boolean | shortCircuit | 
public abstract String type
public abstract String fieldName
public abstract String message
public abstract String key
public abstract String[] messageParams
public abstract ValidationParameter[] parameters
Copyright © 2000–2025 Apache Software Foundation. All rights reserved.