Save This Page
Home » commons-validator-1.3.1-src » org.apache.commons » validator » [javadoc | source]
org.apache.commons.validator
public class: Field [javadoc | source]
java.lang.Object
   org.apache.commons.validator.Field

All Implemented Interfaces:
    Cloneable, Serializable

This contains the list of pluggable validators to run on a field and any message information and variables to perform the validations and generate error messages. Instances of this class are configured with a <field> xml element.

The use of FastHashMap is deprecated and will be replaced in a future release.

Field Summary
public static final  String TOKEN_INDEXED    This indicates an indexed property is being referenced. 
protected static final  String TOKEN_START    The start of a token. 
protected static final  String TOKEN_END    The end of a token. 
protected static final  String TOKEN_VAR    A Vriable token. 
protected  String property    The Field's property name. 
protected  String indexedProperty    The Field's indexed property name. 
protected  String indexedListProperty    The Field's indexed list property name. 
protected  String key    The Field's unique key. 
protected  String depends    A comma separated list of validator's this field depends on. 
protected  int page    The Page Number 
protected  int fieldOrder    The order of the Field in the Form. 
protected  FastHashMap hVars   
     
    protected  FastHashMap hMsgs   
       
      protected  Map[] args    Holds Maps of arguments. args[0] returns the Map for the first replacement argument. Start with a 0 length array so that it will only grow to the size of the highest argument position.
        since: Validator - 1.1
       
      Method from org.apache.commons.validator.Field Summary:
      addArg,   addMsg,   addVar,   addVar,   clone,   generateKey,   getArg,   getArg,   getArgs,   getDependencyList,   getDepends,   getFieldOrder,   getIndexedListProperty,   getIndexedProperty,   getIndexedProperty,   getKey,   getMessage,   getMessages,   getMsg,   getMsgMap,   getPage,   getProperty,   getVar,   getVarMap,   getVarValue,   getVars,   isDependency,   isIndexed,   process,   setDepends,   setFieldOrder,   setIndexedListProperty,   setIndexedProperty,   setKey,   setPage,   setProperty,   toString,   validate
      Methods from java.lang.Object:
      equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
      Method from org.apache.commons.validator.Field Detail:
       public  void addArg(Arg arg) 
        Add an Arg to the replacement argument list.
       public  void addMsg(Msg msg) 
        Add a Msg to the Field.
       public  void addVar(Var v) 
        Add a Var to the Field.
       public  void addVar(String name,
          String value,
          String jsType) 
        Add a Var, based on the values passed in, to the Field.
       public Object clone() 
        Creates and returns a copy of this object.
       public  void generateKey() 
        Generate correct key value.
       public Arg getArg(int position) 
        Gets the default Arg object at the given position.
       public Arg getArg(String key,
          int position) 
        Gets the Arg object at the given position. If the key finds a null value then the default value will be retrieved.
       public Arg[] getArgs(String key) 
        Retrieves the Args for the given validator name.
       public List getDependencyList() 
        Gets an unmodifiable List of the dependencies in the same order they were defined in parameter passed to the setDepends() method.
       public String getDepends() 
        Gets the validation rules for this field as a comma separated list.
       public int getFieldOrder() 
        Gets the position of the Field in the validation list.
       public String getIndexedListProperty() 
        Gets the indexed property name of the field. This is the method name that will return an array or a Collection used to retrieve the list and then loop through the list performing the specified validations.
       public String getIndexedProperty() 
        Gets the indexed property name of the field. This is the method name that can take an int as a parameter for indexed property value retrieval.
       Object[] getIndexedProperty(Object bean) throws ValidatorException 
        Returns an indexed property from the object we're validating.
       public String getKey() 
        Gets a unique key based on the property and indexedProperty fields.
       public Msg getMessage(String key) 
        Retrieve a message object.
       public Map getMessages() 
        The Field's messages are returned as an unmodifiable Map.
       public String getMsg(String key) 
        Retrieve a message value.
       protected Map getMsgMap() 
        Returns a Map of String Msg names to Msg objects.
       public int getPage() 
        Gets the page value that the Field is associated with for validation.
       public String getProperty() 
        Gets the property name of the field.
       public Var getVar(String mainKey) 
        Retrieve a variable.
       protected Map getVarMap() 
        Returns a Map of String Var names to Var objects.
       public String getVarValue(String mainKey) 
        Retrieve a variable's value.
       public Map getVars() 
        The Field's variables are returned as an unmodifiable Map.
       public boolean isDependency(String validatorName) 
        Checks if the validator is listed as a dependency.
       public boolean isIndexed() 
        If there is a value specified for the indexedProperty field then true will be returned. Otherwise it will be false.
        void process(Map globalConstants,
          Map constants) 
        Replace constants with values in fields and process the depends field to create the dependency Map.
       public  void setDepends(String depends) 
        Sets the validation rules for this field as a comma separated list.
       public  void setFieldOrder(int fieldOrder) 
        Sets the position of the Field in the validation list.
       public  void setIndexedListProperty(String indexedListProperty) 
        Sets the indexed property name of the field.
       public  void setIndexedProperty(String indexedProperty) 
        Sets the indexed property name of the field.
       public  void setKey(String key) 
        Sets a unique key for the field. This can be used to change the key temporarily to have a unique key for an indexed field.
       public  void setPage(int page) 
        Sets the page value that the Field is associated with for validation.
       public  void setProperty(String property) 
        Sets the property name of the field.
       public String toString() 
        Returns a string representation of the object.
       public ValidatorResults validate(Map params,
          Map actions) throws ValidatorException 
        Run the configured validations on this field. Run all validations in the depends clause over each item in turn, returning when the first one fails.