Java Doc for Validated.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » site » 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 » Web Framework » rife 1.6.1 » com.uwyn.rife.site 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.uwyn.rife.site.Validated

Validated
public interface Validated (Code)
This interface defines methods for bean-centric data validation.

Validation is bound to subjects that have distinct names. Each subject corresponds to a different variable, for example a property of a bean. When a subject is found to be invalid, a corresponding instance of ValidationError has to be registered.

ValidationErrors indicate in detail why a Validated object doesn't contain valid data. They should be stored internally and can be manipulated by other classes that are able to work with Validated objects. This makes it possible to collect errors incrementally in one central place and to allow each component in a system to perform its own part of the validation.

A Validated object has a Validated.validate() validate() method which should be used to perform mandatory validation on subjects and data that the object itself knows about. This validation has to perform all checks that guarantee a coherent internal state of the data. Note that this method should not reset the validation, but instead add new validation errors to an already existing collection.

Since it's possible that subjects generate multiple ValidationErrors, it's possible to limit their number and only store the first error that occurs for a particular subject.
author:
   Geert Bevin (gbevin[remove] at uwyn dot com)
version:
   $Revision: 3634 $
See Also:   ValidationError
See Also:   ValidationContext
since:
   1.0





Method Summary
public  voidaddRule(ValidationRule rule)
    

Adds a new validation rule.

The collection of rules is what is supposed to perform the validation, though any other additional method could be used.

public  voidaddValidationError(ValidationError error)
     Add a new validation error explicitly to the collection of already existing errors.
public  intcountValidationErrors()
     Counts the number of stored ValidationErrors.
public  List<ValidationRule>getRules()
     Retrieves that validation rules that have been registered.
public  List<String>getValidatedSubjects()
     Returns the list of subjects that this object is able to validate internally through the Validated.validate() validate() method.
public  Set<ValidationError>getValidationErrors()
     Returns a set with all the stored ValidationErrors. A Set instance with all the storedValidationErrors.
public  booleanisSubjectValid(String subject)
     Checks if a subject is valid.

This is determined by verifying if there are ValidationErrors present for it.

public  voidlimitSubjectErrors(String subject)
     Limits the number of errors for a particular subject so that maximum one ValidationError can be stored for it.
public  voidmakeErrorValid(String identifier, String subject)
     Makes errors for a particular subject and identifier valid.
public  voidmakeSubjectValid(String subject)
     Makes a subject valid.
public  voidprovideValidatedBean(Validated bean)
     Provide the bean instance that will be validated.
public  voidreplaceValidationErrors(Set<ValidationError> errors)
     Replaces the stored ValidationErrors with a new set of errors.
public  voidresetValidation()
    

Resets the validation by removing all validation errors that are currently present.

public  ValidatedretrieveValidatedBean()
     Retrieves the bean instance that will be validated.
public  voidunlimitSubjectErrors(String subject)
     Unlimits the number of errors for a particular subject so that any number of ValidationErrors can be stored for it.
public  booleanvalidate()
     Validates the internal subjects.
public  booleanvalidate(ValidationContext context)
     Validates the internal subjects and also validates the bean within the provided ValidationContext

This method is not suppossed to reset the validation errors or to start the validation from scratch, but it's intended to add additional errors to an existing collection.




Method Detail
addRule
public void addRule(ValidationRule rule)(Code)

Adds a new validation rule.

The collection of rules is what is supposed to perform the validation, though any other additional method could be used. At least those rules that have been registered will be evaluated.
Parameters:
  rule - the rule that will be added
See Also:   Validated.validate()
See Also:   Validated.getRules()
since:
   1.4




addValidationError
public void addValidationError(ValidationError error)(Code)
Add a new validation error explicitly to the collection of already existing errors.

Note that this method should respect subjects with a limited error amount and only store the first error for these subjects.
Parameters:
  error - the ValidationError to add
See Also:   Validated.limitSubjectErrors(String)
See Also:   Validated.unlimitSubjectErrors(String)
since:
   1.0




countValidationErrors
public int countValidationErrors()(Code)
Counts the number of stored ValidationErrors. The number of stored ValidationErrors.
since:
   1.0



getRules
public List<ValidationRule> getRules()(Code)
Retrieves that validation rules that have been registered.
See Also:   Validated.validate()
See Also:   Validated.addRule
since:
   1.0



getValidatedSubjects
public List<String> getValidatedSubjects()(Code)
Returns the list of subjects that this object is able to validate internally through the Validated.validate() validate() method. a List instance with the names of the internally validatedsubjects
since:
   1.0



getValidationErrors
public Set<ValidationError> getValidationErrors()(Code)
Returns a set with all the stored ValidationErrors. A Set instance with all the storedValidationErrors. Note that when no errors are availablean empty set is returned, not null.
since:
   1.0



isSubjectValid
public boolean isSubjectValid(String subject)(Code)
Checks if a subject is valid.

This is determined by verifying if there are ValidationErrors present for it. This method will thus not execute a validation action.
Parameters:
  subject - the name of the subject that has to be checked. true when no errors could be found for thesubject; or

false when errors are present for the subject.
See Also:   Validated.validate()
since:
   1.0




limitSubjectErrors
public void limitSubjectErrors(String subject)(Code)
Limits the number of errors for a particular subject so that maximum one ValidationError can be stored for it.
Parameters:
  subject - the name of the subject that has to be limited.
since:
   1.0



makeErrorValid
public void makeErrorValid(String identifier, String subject)(Code)
Makes errors for a particular subject and identifier valid.

This is done by removing all ValidationErrors that are stored with this identifier and subject.
Parameters:
  identifier - the name of the error identifier that has to be made
Parameters:
  subject - the name of the subject that has to be made valid.valid.
since:
   1.0




makeSubjectValid
public void makeSubjectValid(String subject)(Code)
Makes a subject valid.

This is done by removing all ValidationErrors that are stored for it.
Parameters:
  subject - the name of the subject that has to be made valid.
since:
   1.0




provideValidatedBean
public void provideValidatedBean(Validated bean)(Code)
Provide the bean instance that will be validated.

By default 'this' will be used.
Parameters:
  bean - the bean instance that will be validated
since:
   1.4




replaceValidationErrors
public void replaceValidationErrors(Set<ValidationError> errors)(Code)
Replaces the stored ValidationErrors with a new set of errors.
Parameters:
  errors - the Set instance that contains all theValidationErrors that have to be stored.
since:
   1.0



resetValidation
public void resetValidation()(Code)

Resets the validation by removing all validation errors that are currently present.

This method is typically used to start a new validation from scratch or to re-validate until all errors have been solved.
See Also:   Validated.validate()
since:
   1.0




retrieveValidatedBean
public Validated retrieveValidatedBean()(Code)
Retrieves the bean instance that will be validated.
since:
   1.4



unlimitSubjectErrors
public void unlimitSubjectErrors(String subject)(Code)
Unlimits the number of errors for a particular subject so that any number of ValidationErrors can be stored for it.
Parameters:
  subject - the name of the subject that has to be unlimited.
since:
   1.0



validate
public boolean validate()(Code)
Validates the internal subjects.

This method is not suppossed to reset the validation errors or to start the validation from scratch, but it's intended to add additional errors to an existing collection. true if no validation errors are present after thevalidation; or

false if validation errors are available.
See Also:   Validated.validate(ValidationContext)
See Also:   Validated.resetValidation()
since:
   1.0




validate
public boolean validate(ValidationContext context)(Code)
Validates the internal subjects and also validates the bean within the provided ValidationContext

This method is not suppossed to reset the validation errors or to start the validation from scratch, but it's intended to add additional errors to an existing collection.
Parameters:
  context - the ValidationContext in which this beaninstance will be additionally validated true if no validation errors are present after thevalidation; or

false if validation errors are available.
See Also:   Validated.validate()
See Also:   Validated.resetValidation()
since:
   1.0




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