(Available since v1.1)
Requires that a value conforms to a scripted validation. The script can be specified either in the same location or can be placed in an external location. The script receives the following variables :
The script must return true if the data is valid, or false otherwise
Javadoc Ref :
@ScriptValidation
Input Types 1 |
Object |
Output Types |
Same as input |
1Automatic conversion will take place if the provided input does not match any of the input classes, as described in the conversions part of the manual.
language |
Language of the script. Default is "JavaScript". |
script |
Script code |
scriptResource |
Name of an external resource containing the script code |
resourceEncoding |
If the script is specified externally, this attribute specifies the character encoding used in the resource. Default is iso-8859-1 |
exceptionPolicy |
Specifies what happens if the script throws an exception. Can be one of the following values (all of them belonging to the
|
scriptFunction |
Specifies which function from the script to call. If not specified, the script will be executed using "immediate mode". Otherwise, the specified function will be invoked, and will be passed the following parameters (in order):
The function must return a true/false result. |
message |
Literal message to use if validation fails. |
errorCode |
Error code to use if validation fails. |
messageKey |
Message key to use if validation fails. |
@ScriptValidation(script="__data > 3")
private int field;