org.apache.commons.validator
Class ValidatorAction

java.lang.Object
  |
  +--org.apache.commons.validator.ValidatorAction
All Implemented Interfaces:
java.io.Serializable

public class ValidatorAction
extends java.lang.Object
implements java.io.Serializable

Contains the information to dynamically instantiate and run a validation method. This is the class representation of a pluggable validator that can be defined in an xml file.
    Note: The validation method is assumed to be thread safe.

Version:
$Revision: 1.5 $ $Date: 2002/03/30 04:33:17 $
Author:
David Winterfeldt
See Also:
Serialized Form

Field Summary
private  java.lang.String classname
          The full class name of the class containing the validation method associated with this action.
private  java.lang.String depends
          The other ValidatorActions that this one depends on.
private  org.apache.commons.collections.FastHashMap hDependencies
          A FastHashMap of the other ValiadtorActions this one depends on (if any).
private  java.lang.Object instance
          If the java method matching the correct signature isn't static, the instance is stored in the action.
private  java.lang.String javascript
          An optional field to containing a JavaScript representation of the java method assocated with this action.
private  java.lang.String jsFunctionName
          An optional field to contain the name to be used if JavaScript is generated.
private  java.util.List lMethodParams
          A list of all the validation method's parameters.
private  java.lang.String method
          The full method name of the validation to be performed.
private  java.lang.String methodParams
          The method signature of the validation method.
private  java.lang.String msg
          The default error message associated with this action.
private  java.lang.String name
          The name of the validation.
 
Constructor Summary
ValidatorAction()
           
 
Method Summary
 java.lang.String getClassname()
          Gets the class of the validator action.
 java.lang.Object getClassnameInstance()
          Gets an instance based on the validator action's classname.
 java.util.Collection getDependencies()
          Gets the dependencies as a Collection.
 java.lang.String getDepends()
          Gets the dependencies of the validator action.
 java.lang.String getJavascript()
          Gets the Javascript equivalent of the java class and method associated with this action.
 java.lang.String getJsFunctionName()
          Gets the Javascript function name.
 java.lang.String getMethod()
          Gets the name of method being called for the validator action.
 java.lang.String getMethodParams()
          Gets the method parameters for the method.
 java.util.List getMethodParamsList()
          Gets the method parameters for the method.
 java.lang.String getMsg()
          Gets the message associated with the validator action.
 java.lang.String getName()
          Gets the name of the validator action.
 boolean isDependency(java.lang.String key)
          Checks whether or not the value passed in is in the depends field.
 void process(java.util.Map globalConstants)
          Creates a FastHashMap for the isDependency method based on depends.
 void setClassname(java.lang.String classname)
          Sets the class of the validator action.
 void setClassnameInstance(java.lang.Object instance)
          Sets an instance based on the validator action's classname.
 void setDepends(java.lang.String depends)
          Sets the dependencies of the validator action.
 void setJavascript(java.lang.String javascript)
          Sets the Javascript equivalent of the java class and method associated with this action.
 void setJsFunctionName(java.lang.String jsFunctionName)
          Sets the Javascript function name.
 void setMethod(java.lang.String method)
          Sets the name of method being called for the validator action.
 void setMethodParams(java.lang.String methodParams)
          Sets the method parameters for the method.
 void setMsg(java.lang.String msg)
          Sets the message associated with the validator action.
 void setName(java.lang.String name)
          Sets the name of the validator action.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

name

private java.lang.String name
The name of the validation.

classname

private java.lang.String classname
The full class name of the class containing the validation method associated with this action.

method

private java.lang.String method
The full method name of the validation to be performed. The method must be thread safe.

methodParams

private java.lang.String methodParams

The method signature of the validation method. This should be a comma delimited list of the full class names of each parameter in the correct order that the method takes.

Note: java.lang.Object is reserved for the JavaBean that is being validated. The ValidatorAction and Field that are associated with a fields validation will automatically be populated if they are specified in the method signature.


depends

private java.lang.String depends
The other ValidatorActions that this one depends on. If any errors occur in an action that this one depends on, this action will not be processsed.

msg

private java.lang.String msg
The default error message associated with this action.

jsFunctionName

private java.lang.String jsFunctionName
An optional field to contain the name to be used if JavaScript is generated.

javascript

private java.lang.String javascript
An optional field to containing a JavaScript representation of the java method assocated with this action.

instance

private java.lang.Object instance
If the java method matching the correct signature isn't static, the instance is stored in the action. This assumes the method is thread safe.

hDependencies

private org.apache.commons.collections.FastHashMap hDependencies
A FastHashMap of the other ValiadtorActions this one depends on (if any).

lMethodParams

private java.util.List lMethodParams
A list of all the validation method's parameters.
Constructor Detail

ValidatorAction

public ValidatorAction()
Method Detail

getName

public java.lang.String getName()
Gets the name of the validator action.

setName

public void setName(java.lang.String name)
Sets the name of the validator action.

getClassname

public java.lang.String getClassname()
Gets the class of the validator action.

setClassname

public void setClassname(java.lang.String classname)
Sets the class of the validator action.

getMethod

public java.lang.String getMethod()
Gets the name of method being called for the validator action.

setMethod

public void setMethod(java.lang.String method)
Sets the name of method being called for the validator action.

getMethodParams

public java.lang.String getMethodParams()
Gets the method parameters for the method.

setMethodParams

public void setMethodParams(java.lang.String methodParams)
Sets the method parameters for the method.

getMethodParamsList

public java.util.List getMethodParamsList()
Gets the method parameters for the method.

getDepends

public java.lang.String getDepends()
Gets the dependencies of the validator action.

setDepends

public void setDepends(java.lang.String depends)
Sets the dependencies of the validator action.

getMsg

public java.lang.String getMsg()
Gets the message associated with the validator action.

setMsg

public void setMsg(java.lang.String msg)
Sets the message associated with the validator action.

getJsFunctionName

public java.lang.String getJsFunctionName()
Gets the Javascript function name. This is optional and can be used instead of validator action name for the name of the Javascript function/object.

setJsFunctionName

public void setJsFunctionName(java.lang.String jsFunctionName)
Sets the Javascript function name. This is optional and can be used instead of validator action name for the name of the Javascript function/object.

getJavascript

public java.lang.String getJavascript()
Gets the Javascript equivalent of the java class and method associated with this action.

setJavascript

public void setJavascript(java.lang.String javascript)
Sets the Javascript equivalent of the java class and method associated with this action.

getClassnameInstance

public java.lang.Object getClassnameInstance()
Gets an instance based on the validator action's classname.

setClassnameInstance

public void setClassnameInstance(java.lang.Object instance)
Sets an instance based on the validator action's classname.

process

public void process(java.util.Map globalConstants)
Creates a FastHashMap for the isDependency method based on depends.

isDependency

public boolean isDependency(java.lang.String key)
Checks whether or not the value passed in is in the depends field.

getDependencies

public java.util.Collection getDependencies()
Gets the dependencies as a Collection.

toString

public java.lang.String toString()
Returns a string representation of the object.
Overrides:
toString in class java.lang.Object


Copyright (c) 2001-2002 - Apache Software Foundation