Java Doc for Validator.java in  » Development » OVal » net » sf » oval » 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 » Development » OVal » net.sf.oval 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.sf.oval.Validator

All known Subclasses:   net.sf.oval.guard.Guard,
Validator
public class Validator (Code)

author:
   Sebastian Thomschke


Field Summary
protected  Map<String, ExpressionLanguage>expressionLanguages
    
protected  ParameterNameResolverparameterNameResolver
    

Constructor Summary
public  Validator()
    
public  Validator(Collection<Configurer> configurers)
    
public  Validator(Configurer... configurers)
    

Method Summary
public  voidaddChecks(Class clazz, Check... checks)
    
protected  voidaddChecks(ClassChecks cc, ClassConfiguration classConfig)
    
public  voidaddChecks(Field field, Check... checks)
    
public  voidaddChecks(Method invariantMethod, Check... checks)
    
public  voidaddConstraintSet(ConstraintSet constraintSet, boolean overwrite)
     Registers a new constraint set.
public  voidaddExpressionLanguage(String languageId, ExpressionLanguage expressionLanguage)
    
public  voidassertValid(Object validatedObject)
    
public  voidassertValidFieldValue(Object validatedObject, Field validatedField, Object fieldValueToValidate)
    
protected  voidcheckConstraint(List<ConstraintViolation> violations, Check check, Object validatedObject, Object valueToValidate, OValContext context)
    
protected  voidcheckConstraintAssertConstraintSet(List<ConstraintViolation> violations, AssertConstraintSetCheck check, Object validatedObject, Object valueToValidate, OValContext context)
    
protected  voidcheckConstraintAssertFieldConstraints(List<ConstraintViolation> violations, AssertFieldConstraintsCheck check, Object validatedObject, Object valueToValidate, OValContext context)
    
protected  voidcheckConstraintAssertValid(List<ConstraintViolation> violations, AssertValidCheck check, Object validatedObject, Object valueToValidate, OValContext context)
    
public synchronized  voiddisableAllProfiles()
     Enables all constraint profiles, i.e.
public  voiddisableProfile(String profile)
     Disables a constraints profile.
public synchronized  voidenableAllProfiles()
     Disables all constraint profiles, i.e.
public  voidenableProfile(String profile)
     Enables a constraints profile.
public  Check[]getChecks(Class clazz)
    
public  Check[]getChecks(Field field)
    
public  Check[]getChecks(Method method)
    
protected  ClassChecksgetClassChecks(Class clazz)
    
public static  CollectionFactorygetCollectionFactory()
    
public  List<Configurer>getConfigurers()
    
public  ConstraintSetgetConstraintSet(String constraintSetId)
    
public  ExceptionTranslatorgetExceptionTranslator()
    
public  ExpressionLanguagegetExpressionLanguage(String languageId)
    
public static  LoggerFactorygetLoggerFactory()
    
public static  MessageResolvergetMessageResolver()
    
protected  booleanisAnyProfileEnabled(String[] profileIds)
     Determines if at least one of the given profiles is enabled
Parameters:
  profileIds - Returns true if at least one of the given profiles is enabled.
protected  booleanisCurrentlyValidated(Object object)
    
public  booleanisProfileEnabled(String profileId)
     Determines if the given profile is enabled.
public  voidreconfigureChecks()
    
public  voidremoveChecks(Class clazz, Check... checks)
    
public  voidremoveChecks(Field field, Check... checks)
    
public  voidremoveChecks(Method getter, Check... checks)
    
public  ConstraintSetremoveConstraintSet(String id)
    
protected  StringrenderMessage(OValContext context, Object value, String messageKey, Map<String, String> messageValues)
    
public static  voidsetCollectionFactory(CollectionFactory factory)
    
public  voidsetExceptionTranslator(ExceptionTranslator exceptionTranslator)
    
public static  voidsetLoggerFactory(LoggerFactory loggerFactory)
    
public static  voidsetMessageResolver(MessageResolver messageResolver)
    
protected  RuntimeExceptiontranslateException(OValException ex)
    
public  List<ConstraintViolation>validate(Object validatedObject)
     validates the field and getter constrains of the given object
Parameters:
  validatedObject - the object to validate, cannot be null a list with the detected constraint violations.
public  List<ConstraintViolation>validateFieldValue(Object validatedObject, Field validatedField, Object fieldValueToValidate)
     Validates the give value against the defined field constraints.
a list with the detected constraint violations.
protected  voidvalidateInvariants(Object validatedObject, List<ConstraintViolation> violations)
     validates the field and getter constrains of the given object.

Field Detail
expressionLanguages
protected Map<String, ExpressionLanguage> expressionLanguages(Code)



parameterNameResolver
protected ParameterNameResolver parameterNameResolver(Code)




Constructor Detail
Validator
public Validator()(Code)
Constructs a new validator object and uses a new isntance of AnnotationsConfigurer



Validator
public Validator(Collection<Configurer> configurers)(Code)



Validator
public Validator(Configurer... configurers)(Code)




Method Detail
addChecks
public void addChecks(Class clazz, Check... checks) throws IllegalArgumentException(Code)
Registers object-level constraint checks
Parameters:
  clazz -
Parameters:
  checks -
throws:
  IllegalArgumentException - if clazz == null or checks == null or checks is empty



addChecks
protected void addChecks(ClassChecks cc, ClassConfiguration classConfig) throws OValException(Code)



addChecks
public void addChecks(Field field, Check... checks) throws IllegalArgumentException(Code)
Registers constraint checks for the given field
Parameters:
  field -
Parameters:
  checks -
throws:
  IllegalArgumentException - if field == null or checks == null or checks is empty



addChecks
public void addChecks(Method invariantMethod, Check... checks) throws IllegalArgumentException, InvalidConfigurationException(Code)
Registers constraint checks for the given getter's return value
Parameters:
  invariantMethod - a non-void, non-parameterized method (usually a JavaBean Getter style method)
Parameters:
  checks -
throws:
  IllegalArgumentException - if getter == null or checks == null
throws:
  InvalidConfigurationException - if getter is not a getter method



addConstraintSet
public void addConstraintSet(ConstraintSet constraintSet, boolean overwrite) throws ConstraintSetAlreadyDefinedException, IllegalArgumentException(Code)
Registers a new constraint set.
Parameters:
  constraintSet - cannot be null
Parameters:
  overwrite -
throws:
  ConstraintSetAlreadyDefinedException - if overwrite == false and a constraint set with the given id exists already
throws:
  IllegalArgumentException - if constraintSet == null or constraintSet.id == null or constraintSet.id.length == 0
throws:
  IllegalArgumentException - if constraintSet.id == null



addExpressionLanguage
public void addExpressionLanguage(String languageId, ExpressionLanguage expressionLanguage) throws IllegalArgumentException(Code)

Parameters:
  languageId -
Parameters:
  expressionLanguage -
throws:
  IllegalArgumentException - if languageId == null || expressionLanguage == null



assertValid
public void assertValid(Object validatedObject) throws IllegalArgumentException, ValidationFailedException, ConstraintsViolatedException(Code)
validates the field and getter constrains of the given object and throws an ConstraintsViolatedException if any constraint violations are detected
Parameters:
  validatedObject - the object to validate, cannot be null
throws:
  ConstraintsViolatedException -
throws:
  ValidationFailedException -
throws:
  IllegalArgumentException - if validatedObject == null



assertValidFieldValue
public void assertValidFieldValue(Object validatedObject, Field validatedField, Object fieldValueToValidate) throws IllegalArgumentException, ValidationFailedException, ConstraintsViolatedException(Code)
Validates the give value against the defined field constraints and throws an ConstraintsViolatedException if any constraint violations are detected.

Parameters:
  validatedObject - the object to validate, cannot be null
Parameters:
  validatedField - the field to validate, cannot be null
throws:
  IllegalArgumentException - if validatedObject == null or field == null
throws:
  ConstraintsViolatedException -
throws:
  ValidationFailedException -



checkConstraint
protected void checkConstraint(List<ConstraintViolation> violations, Check check, Object validatedObject, Object valueToValidate, OValContext context) throws OValException(Code)



checkConstraintAssertConstraintSet
protected void checkConstraintAssertConstraintSet(List<ConstraintViolation> violations, AssertConstraintSetCheck check, Object validatedObject, Object valueToValidate, OValContext context) throws OValException(Code)



checkConstraintAssertFieldConstraints
protected void checkConstraintAssertFieldConstraints(List<ConstraintViolation> violations, AssertFieldConstraintsCheck check, Object validatedObject, Object valueToValidate, OValContext context) throws OValException(Code)



checkConstraintAssertValid
protected void checkConstraintAssertValid(List<ConstraintViolation> violations, AssertValidCheck check, Object validatedObject, Object valueToValidate, OValContext context) throws OValException(Code)



disableAllProfiles
public synchronized void disableAllProfiles()(Code)
Enables all constraint profiles, i.e. all configured constraint will be validated.



disableProfile
public void disableProfile(String profile)(Code)
Disables a constraints profile.
Parameters:
  profile - the id of the profile



enableAllProfiles
public synchronized void enableAllProfiles()(Code)
Disables all constraint profiles, i.e. no configured constraint will be validated.



enableProfile
public void enableProfile(String profile)(Code)
Enables a constraints profile.
Parameters:
  profile - the id of the profile



getChecks
public Check[] getChecks(Class clazz) throws IllegalArgumentException(Code)
Gets the object-level constraint checks for the given class
Parameters:
  clazz -
throws:
  IllegalArgumentException - if clazz == null



getChecks
public Check[] getChecks(Field field) throws IllegalArgumentException(Code)
Gets the constraint checks for the given field
Parameters:
  field -
throws:
  IllegalArgumentException - if field == null



getChecks
public Check[] getChecks(Method method) throws IllegalArgumentException(Code)
Gets the constraint checks for the given method's return value
Parameters:
  method -
throws:
  IllegalArgumentException - if getter == null



getClassChecks
protected ClassChecks getClassChecks(Class clazz) throws IllegalArgumentException, OValException(Code)
Returns the ClassChecks object for the particular class, allowing you to modify the checks
Parameters:
  clazz - cannot be null returns the ClassChecks for the given class
throws:
  IllegalArgumentException - if clazz == null
throws:
  OValException -



getCollectionFactory
public static CollectionFactory getCollectionFactory()(Code)
Returns a shared instance of the CollectionFactory



getConfigurers
public List<Configurer> getConfigurers()(Code)
the internal list with the registered configurers



getConstraintSet
public ConstraintSet getConstraintSet(String constraintSetId) throws OValException(Code)



getExceptionTranslator
public ExceptionTranslator getExceptionTranslator()(Code)
the exceptionProcessor



getExpressionLanguage
public ExpressionLanguage getExpressionLanguage(String languageId) throws IllegalArgumentException, ExpressionLanguageNotAvailableException(Code)

Parameters:
  languageId - the id of the language, cannot be null
throws:
  IllegalArgumentException - if languageName == null
throws:
  ExpressionLanguageNotAvailableException -



getLoggerFactory
public static LoggerFactory getLoggerFactory()(Code)
the loggerFactory



getMessageResolver
public static MessageResolver getMessageResolver()(Code)
the messageResolver



isAnyProfileEnabled
protected boolean isAnyProfileEnabled(String[] profileIds)(Code)
Determines if at least one of the given profiles is enabled
Parameters:
  profileIds - Returns true if at least one of the given profiles is enabled.



isCurrentlyValidated
protected boolean isCurrentlyValidated(Object object)(Code)
Determines if the given object is currently validated in the current thread
Parameters:
  object - Returns true if the given object is currently validated in the current thread.



isProfileEnabled
public boolean isProfileEnabled(String profileId)(Code)
Determines if the given profile is enabled.
Parameters:
  profileId - Returns true if the given profile is enabled.



reconfigureChecks
public void reconfigureChecks()(Code)
clears the checks and constraint sets => a reconfiguration using the currently registered configurers will automatically happen



removeChecks
public void removeChecks(Class clazz, Check... checks) throws IllegalArgumentException(Code)
Removes object-level constraint checks
Parameters:
  clazz -
Parameters:
  checks -
throws:
  IllegalArgumentException - if clazz == null or checks == null or checks is empty



removeChecks
public void removeChecks(Field field, Check... checks) throws IllegalArgumentException(Code)
Removes constraint checks for the given field
Parameters:
  field -
Parameters:
  checks -
throws:
  IllegalArgumentException - if field == null or checks == null or checks is empty



removeChecks
public void removeChecks(Method getter, Check... checks) throws IllegalArgumentException(Code)
Removes constraint checks for the given getter's return value
Parameters:
  getter - a JavaBean Getter style method
Parameters:
  checks -
throws:
  IllegalArgumentException - if getter == null or checks == null



removeConstraintSet
public ConstraintSet removeConstraintSet(String id) throws IllegalArgumentException(Code)
Removes the constraint set with the given id
Parameters:
  id - the id of the constraint set to remove, cannot be null the removed constraint set
throws:
  IllegalArgumentException - if id == null



renderMessage
protected String renderMessage(OValContext context, Object value, String messageKey, Map<String, String> messageValues)(Code)



setCollectionFactory
public static void setCollectionFactory(CollectionFactory factory) throws IllegalArgumentException(Code)

Parameters:
  factory - the new collection factory to be used by all validator instances



setExceptionTranslator
public void setExceptionTranslator(ExceptionTranslator exceptionTranslator)(Code)

Parameters:
  exceptionTranslator - the exceptionTranslator to set



setLoggerFactory
public static void setLoggerFactory(LoggerFactory loggerFactory)(Code)

Parameters:
  loggerFactory - the loggerFactory to set



setMessageResolver
public static void setMessageResolver(MessageResolver messageResolver) throws IllegalArgumentException(Code)

Parameters:
  messageResolver - the messageResolver to set
throws:
  IllegalArgumentException - if messageResolver == null



translateException
protected RuntimeException translateException(OValException ex)(Code)



validate
public List<ConstraintViolation> validate(Object validatedObject) throws IllegalArgumentException, ValidationFailedException(Code)
validates the field and getter constrains of the given object
Parameters:
  validatedObject - the object to validate, cannot be null a list with the detected constraint violations. if no violations are detected an empty list is returned
throws:
  ValidationFailedException -
throws:
  IllegalArgumentException - if validatedObject == null



validateFieldValue
public List<ConstraintViolation> validateFieldValue(Object validatedObject, Field validatedField, Object fieldValueToValidate) throws IllegalArgumentException, ValidationFailedException(Code)
Validates the give value against the defined field constraints.
a list with the detected constraint violations. if no violations are detected an empty list is returned
throws:
  IllegalArgumentException - if validatedObject == null or field == null
throws:
  ValidationFailedException -



validateInvariants
protected void validateInvariants(Object validatedObject, List<ConstraintViolation> violations) throws IllegalArgumentException, ValidationFailedException(Code)
validates the field and getter constrains of the given object. if the given object is a class the static fields and getters are validated.
Parameters:
  validatedObject - the object to validate, cannot be null
throws:
  ValidationFailedException -
throws:
  IllegalArgumentException - if validatedObject == null



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.