Java Doc for Validator.java in  » Library » Apache-commons-validator-1.3.1-src » org » apache » commons » validator » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache commons validator 1.3.1 src » org.apache.commons.validator 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.validator.Validator

Validator
public class Validator implements Serializable(Code)
Validations are processed by the validate method. An instance of ValidatorResources is used to define the validators (validation methods) and the validation rules for a JavaBean.
version:
   $Revision: 478345 $ $Date: 2006-11-22 22:25:19 +0000 (Wed, 22 Nov 2006) $


Field Summary
final public static  StringBEAN_PARAM
     Resources key the JavaBean is stored to perform validation on.
final public static  StringFIELD_PARAM
     Resources key the Field is stored under.
final public static  StringFORM_PARAM
     Resources key the Form is stored under.
final public static  StringLOCALE_PARAM
     Resources key the Locale is stored.
final public static  StringVALIDATOR_ACTION_PARAM
     Resources key the ValidatorAction is stored under.
final public static  StringVALIDATOR_PARAM
     Resources key the Validator is stored under.
final public static  StringVALIDATOR_RESULTS_PARAM
     Resources key the ValidatorResults is stored under.
protected  ClassLoaderclassLoader
     The class loader to use for instantiating application objects.
protected  StringfieldName
    
protected  StringformName
    
protected  booleanonlyReturnErrors
     Set this to true to not return Fields that pass validation.
protected  intpage
     The current page number to validate.
protected  Mapparameters
     Maps validation method parameter class names to the objects to be passed into the method.
protected  ValidatorResourcesresources
     The Validator Resources.
protected  booleanuseContextClassLoader
     Whether or not to use the Context ClassLoader when loading classes for instantiating new objects.

Constructor Summary
public  Validator(ValidatorResources resources)
     Construct a Validator that will use the ValidatorResources passed in to retrieve pluggable validators the different sets of validation rules.
public  Validator(ValidatorResources resources, String formName)
     Construct a Validator that will use the ValidatorResources passed in to retrieve pluggable validators the different sets of validation rules.
public  Validator(ValidatorResources resources, String formName, String fieldName)
     Construct a Validator that will use the ValidatorResources passed in to retrieve pluggable validators the different sets of validation rules.

Method Summary
public  voidclear()
     Clears the form name, resources that were added, and the page that was set (if any).
public  ClassLoadergetClassLoader()
     Return the class loader to be used for instantiating application objects when required.
public  StringgetFormName()
     Gets the form name which is the key to a set of validation rules.
public  booleangetOnlyReturnErrors()
     Returns true if the Validator is only returning Fields that fail validation.
public  intgetPage()
     Gets the page.
public  ObjectgetParameterValue(String parameterClassName)
     Returns the value of the specified parameter that will be used during the processing of validations.
Parameters:
  parameterClassName - The full class name of the parameter of thevalidation method that corresponds to the value/instance passed in with it.
public  booleangetUseContextClassLoader()
     Return the boolean as to whether the context classloader should be used.
public  voidsetClassLoader(ClassLoader classLoader)
     Set the class loader to be used for instantiating application objects when required.
public  voidsetFieldName(String fieldName)
    
public  voidsetFormName(String formName)
     Sets the form name which is the key to a set of validation rules.
public  voidsetOnlyReturnErrors(boolean onlyReturnErrors)
     Configures which Fields the Validator returns from the validate() method.
public  voidsetPage(int page)
     Sets the page.
public  voidsetParameter(String parameterClassName, Object parameterValue)
     Set a parameter of a pluggable validation method.
public  voidsetUseContextClassLoader(boolean use)
     Determine whether to use the Context ClassLoader (the one found by calling Thread.currentThread().getContextClassLoader()) to resolve/load classes that are defined in various rules.
public  ValidatorResultsvalidate()
     Performs validations based on the configured resources.

Field Detail
BEAN_PARAM
final public static String BEAN_PARAM(Code)
Resources key the JavaBean is stored to perform validation on.



FIELD_PARAM
final public static String FIELD_PARAM(Code)
Resources key the Field is stored under. This will be automatically passed into a validation method with the current Field if it is specified in the method signature.



FORM_PARAM
final public static String FORM_PARAM(Code)
Resources key the Form is stored under. This will be automatically passed into a validation method with the current Form if it is specified in the method signature.



LOCALE_PARAM
final public static String LOCALE_PARAM(Code)
Resources key the Locale is stored. This will be used to retrieve the appropriate FormSet and Form to be processed.



VALIDATOR_ACTION_PARAM
final public static String VALIDATOR_ACTION_PARAM(Code)
Resources key the ValidatorAction is stored under. This will be automatically passed into a validation method with the current ValidatorAction if it is specified in the method signature.



VALIDATOR_PARAM
final public static String VALIDATOR_PARAM(Code)
Resources key the Validator is stored under. This will be automatically passed into a validation method with the current Validator if it is specified in the method signature.



VALIDATOR_RESULTS_PARAM
final public static String VALIDATOR_RESULTS_PARAM(Code)
Resources key the ValidatorResults is stored under. This will be automatically passed into a validation method with the current ValidatorResults if it is specified in the method signature.



classLoader
protected ClassLoader classLoader(Code)
The class loader to use for instantiating application objects. If not specified, the context class loader, or the class loader used to load Digester itself, is used, based on the value of the useContextClassLoader variable.



fieldName
protected String fieldName(Code)
The name of the field on the form to validate
since:
   1.2.0



formName
protected String formName(Code)
The name of the form to validate



onlyReturnErrors
protected boolean onlyReturnErrors(Code)
Set this to true to not return Fields that pass validation. Only return failures.



page
protected int page(Code)
The current page number to validate.



parameters
protected Map parameters(Code)
Maps validation method parameter class names to the objects to be passed into the method.



resources
protected ValidatorResources resources(Code)
The Validator Resources.



useContextClassLoader
protected boolean useContextClassLoader(Code)
Whether or not to use the Context ClassLoader when loading classes for instantiating new objects. Default is false.




Constructor Detail
Validator
public Validator(ValidatorResources resources)(Code)
Construct a Validator that will use the ValidatorResources passed in to retrieve pluggable validators the different sets of validation rules.
Parameters:
  resources - ValidatorResources to use during validation.



Validator
public Validator(ValidatorResources resources, String formName)(Code)
Construct a Validator that will use the ValidatorResources passed in to retrieve pluggable validators the different sets of validation rules.
Parameters:
  resources - ValidatorResources to use during validation.
Parameters:
  formName - Key used for retrieving the set of validation rules.



Validator
public Validator(ValidatorResources resources, String formName, String fieldName)(Code)
Construct a Validator that will use the ValidatorResources passed in to retrieve pluggable validators the different sets of validation rules.
Parameters:
  resources - ValidatorResources to use during validation.
Parameters:
  formName - Key used for retrieving the set of validation rules.
Parameters:
  fieldName - Key used for retrieving the set of validation rules for a field
since:
   1.2.0




Method Detail
clear
public void clear()(Code)
Clears the form name, resources that were added, and the page that was set (if any). This can be called to reinitialize the Validator instance so it can be reused. The form name (key to set of validation rules) and any resources needed, like the JavaBean being validated, will need to set and/or added to this instance again. The ValidatorResources will not be removed since it can be used again and is thread safe.



getClassLoader
public ClassLoader getClassLoader()(Code)
Return the class loader to be used for instantiating application objects when required. This is determined based upon the following rules:
  • The class loader set by setClassLoader(), if any
  • The thread context class loader, if it exists and the useContextClassLoader property is set to true
  • The class loader used to load the Digester class itself.
the class loader.



getFormName
public String getFormName()(Code)
Gets the form name which is the key to a set of validation rules. the name of the form.



getOnlyReturnErrors
public boolean getOnlyReturnErrors()(Code)
Returns true if the Validator is only returning Fields that fail validation. whether only failed fields are returned.



getPage
public int getPage()(Code)
Gets the page. This in conjunction with the page property of a Field can control the processing of fields. If the field's page is less than or equal to this page value, it will be processed. the page number.



getParameterValue
public Object getParameterValue(String parameterClassName)(Code)
Returns the value of the specified parameter that will be used during the processing of validations.
Parameters:
  parameterClassName - The full class name of the parameter of thevalidation method that corresponds to the value/instance passed in with it. value of the specified parameter.



getUseContextClassLoader
public boolean getUseContextClassLoader()(Code)
Return the boolean as to whether the context classloader should be used. whether the context classloader should be used.



setClassLoader
public void setClassLoader(ClassLoader classLoader)(Code)
Set the class loader to be used for instantiating application objects when required.
Parameters:
  classLoader - The new class loader to use, or nullto revert to the standard rules



setFieldName
public void setFieldName(String fieldName)(Code)
Sets the name of the field to validate in a form (optional)
Parameters:
  fieldName - The name of the field in a form set
since:
   1.2.0



setFormName
public void setFormName(String formName)(Code)
Sets the form name which is the key to a set of validation rules.
Parameters:
  formName - the name of the form.



setOnlyReturnErrors
public void setOnlyReturnErrors(boolean onlyReturnErrors)(Code)
Configures which Fields the Validator returns from the validate() method. Set this to true to only return Fields that failed validation. By default, validate() returns all fields.
Parameters:
  onlyReturnErrors - whether only failed fields are returned.



setPage
public void setPage(int page)(Code)
Sets the page. This in conjunction with the page property of a Field can control the processing of fields. If the field's page is less than or equal to this page value, it will be processed.
Parameters:
  page - the page number.



setParameter
public void setParameter(String parameterClassName, Object parameterValue)(Code)
Set a parameter of a pluggable validation method.
Parameters:
  parameterClassName - The full class name of the parameter of thevalidation method that corresponds to the value/instance passed in with it.
Parameters:
  parameterValue - The instance that will be passed into thevalidation method.



setUseContextClassLoader
public void setUseContextClassLoader(boolean use)(Code)
Determine whether to use the Context ClassLoader (the one found by calling Thread.currentThread().getContextClassLoader()) to resolve/load classes that are defined in various rules. If not using Context ClassLoader, then the class-loading defaults to using the calling-class' ClassLoader.
Parameters:
  use - determines whether to use Context ClassLoader.



validate
public ValidatorResults validate() throws ValidatorException(Code)
Performs validations based on the configured resources. The Map returned uses the property of theField for the key and the value is the number of error thefield had.
throws:
  ValidatorException - If an error occurs during validation



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.