public class Validator
extends java.util.HashMap
Contains accessors for all documented Validator properties and a general getProperty() API for retrieving your own properties for custom DataSource implementations.
Modifier and Type | Method and Description |
---|---|
void | addErrorMessageVariable(java.lang.String name, java.lang.String value) Adds a variable to the context used when building error messages for this Validator. |
ErrorMessage | evaluateErrorMessage(ErrorMessage error) Returns the evaluated form of the passed in error message, applying any error message variables that have been assigned to this validator. |
java.lang.String | getErrorMessage() Returns the error message |
java.util.Map | getErrorMessageVariables() Retrieves the current map of error message variables for this Validator |
java.lang.String | getLanguage() Returns language property, which is script language of serverCondition expression that will be executed by the server. |
java.util.List | getListProperty(java.lang.String property) Returns the value of the specified attribute as a List. |
java.util.Map | getMapProperty(java.lang.String property) Returns the value of the specified attribute as a Map. |
java.lang.Object | getObjectProperty(java.lang.String property) Returns the value of the specified element(s) as an Object. Custom XML is transformed to Strings or Java collections by the following rules: Elements with just text (no child elements or attributes) become Strings Elements with child elements or attributes become Maps containing data derived from their subelements Repeating elements (more than one of the same name at the same level) become Lists |
java.lang.String | getProperty(java.lang.String property) Returns the value of the specified attribute as a string. |
java.lang.Object | getScriptImports() Returns script imports, which are used by script defined in serverCondition expression that will be executed by the server. |
java.lang.String | getServerCondition() Returns the server condition, which is an expression that will be executed by the server. |
java.lang.String | getType() Returns the Validator type |
boolean | isClientOnly() Returns whether this Validator is intended to run only on the client |
boolean | isServerOnly() Returns whether this Validator is intended to run only on the server |
boolean | isStopIfFalse() Returns true if validation should stop if this Validator fails. |
public java.lang.String getProperty(java.lang.String property)
property
- the name of the attributeValidator.getObjectProperty(java.lang.String)
, Validator.getListProperty(java.lang.String)
, Validator.getMapProperty(java.lang.String)
public java.lang.Object getObjectProperty(java.lang.String property)
Sample XML:
<validator>
<mapCustomProperty key1="value1" key2="value2" />
</validator>
<validator>
<listCustomProperty>ListElement1</listCustomProperty>
<listCustomProperty>ListElement2</listCustomProperty> </validator>
<validator>
<mapCustomProperty key1="value1" key2="value2" />
<mapCustomProperty key1="value1" key2="value2" />
</validator>
property
- the name of the element(s)Validator.getProperty(java.lang.String)
, Validator.getListProperty(java.lang.String)
, Validator.getMapProperty(java.lang.String)
public java.util.List getListProperty(java.lang.String property)
property
- the name of the attributejava.lang.ClassCastException
- if requested property is not instanceof ListValidator.getProperty(java.lang.String)
, Validator.getObjectProperty(java.lang.String)
, Validator.getMapProperty(java.lang.String)
public java.util.Map getMapProperty(java.lang.String property)
property
- the name of the attributejava.lang.ClassCastException
- if requested property is not instanceof MapValidator.getProperty(java.lang.String)
, Validator.getObjectProperty(java.lang.String)
, Validator.getListProperty(java.lang.String)
public boolean isClientOnly()
public boolean isServerOnly()
public boolean isStopIfFalse()
public java.lang.String getErrorMessage()
public java.lang.String getServerCondition()
public java.lang.Object getScriptImports()
public java.lang.String getLanguage()
public java.lang.String getType()
public void addErrorMessageVariable(java.lang.String name, java.lang.String value)
name
- the name to give the variable in the contextvalue
- the value to associate with the variablepublic java.util.Map getErrorMessageVariables()
public ErrorMessage evaluateErrorMessage(ErrorMessage error) throws java.lang.Exception
error
- The message text to evaluatejava.lang.Exception