public class ValidatorAction extends Object implements Serializable
Constructor and Description |
---|
ValidatorAction() |
Modifier and Type | Method and Description |
---|---|
String |
getClassname()
Gets the class of the validator action.
|
List<String> |
getDependencyList()
Returns the dependent validator names as an unmodifiable
List . |
String |
getDepends()
Gets the dependencies of the validator action as a comma separated list
of validator names.
|
String |
getJavascript()
Gets the Javascript equivalent of the java class and method
associated with this action.
|
String |
getJsFunctionName()
Gets the Javascript function name.
|
String |
getMethod()
Gets the name of method being called for the validator action.
|
String |
getMethodParams()
Gets the method parameters for the method.
|
String |
getMsg()
Gets the message associated with the validator action.
|
String |
getName()
Gets the name of the validator action.
|
protected void |
init()
Initialize based on set.
|
boolean |
isDependency(String validatorName)
Checks whether or not the value passed in is in the depends field.
|
protected void |
loadJavascriptFunction()
Load the javascript function specified by the given path.
|
void |
setClassname(String classname)
Sets the class of the validator action.
|
void |
setDepends(String depends)
Sets the dependencies of the validator action.
|
void |
setJavascript(String javascript)
Sets the Javascript equivalent of the java class and method
associated with this action.
|
void |
setJsFunction(String jsFunction)
Sets the fully qualified class path of the Javascript function.
|
void |
setJsFunctionName(String jsFunctionName)
Sets the Javascript function name.
|
void |
setMethod(String method)
Sets the name of method being called for the validator action.
|
void |
setMethodParams(String methodParams)
Sets the method parameters for the method.
|
void |
setMsg(String msg)
Sets the message associated with the validator action.
|
void |
setName(String name)
Sets the name of the validator action.
|
String |
toString()
Returns a string representation of the object.
|
public String getName()
public void setName(String name)
name
- Validator Action name.public String getClassname()
public void setClassname(String classname)
classname
- Class name of the validator Action.public String getMethod()
public void setMethod(String method)
method
- The method name.public String getMethodParams()
public void setMethodParams(String methodParams)
methodParams
- A comma separated list of parameters.public String getDepends()
public void setDepends(String depends)
depends
- A comma separated list of validator names.public String getMsg()
public void setMsg(String msg)
msg
- The message for the validator action.public String getJsFunctionName()
public void setJsFunctionName(String jsFunctionName)
jsFunctionName
- The Javascript function name.public void setJsFunction(String jsFunction)
This is optional and can be used instead of the setJavascript().
Attempting to call both setJsFunction
and setJavascript
will result in an IllegalStateException
being thrown.
If neither setJsFunction or setJavascript is set then validator will attempt to load the default javascript definition.
Examples If in the validator.xml : #1: <validator name="tire" jsFunction="com.yourcompany.project.tireFuncion"> Validator will attempt to load com.yourcompany.project.validateTireFunction.js from its class path. #2: <validator name="tire"> Validator will use the name attribute to try and load org.apache.commons.validator.javascript.validateTire.js which is the default javascript definition.
jsFunction
- The Javascript function's fully qualified class path.public String getJavascript()
public void setJavascript(String javascript)
javascript
- The Javascript validation.protected void init()
protected void loadJavascriptFunction()
jsFunction
property should contain a
fully qualified package and script name, separated by periods, to be
loaded from the class loader that created this instance.
TODO if the path begins with a '/' the path will be intepreted as
absolute, and remain unchanged. If this fails then it will attempt to
treat the path as a file path. It is assumed the script ends with a
'.js'.public boolean isDependency(String validatorName)
validatorName
- Name of the dependency to check.public List<String> getDependencyList()
List
.Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.