|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.javalid.core.AnnotationValidatorImpl
public class AnnotationValidatorImpl
Core validator implementing AnnotationValidator interface.
Changes for 1.0.1:
| Field Summary | |
|---|---|
protected AnnotationSupport |
annotationSupport
|
protected CacheSupport |
cacheSupport
|
protected DebugSupport |
debugSupport
|
protected JvConfiguration |
jvConfig
|
protected JvConfigurationWrapper |
jvConfigWrapper
Wrapper around JvConfiguration, this one should be passed to client code (e.g. validator implementations). |
| Constructor Summary | |
|---|---|
AnnotationValidatorImpl()
Default constructor, using the default XML config file for JV. |
|
AnnotationValidatorImpl(java.lang.String xmlConfigFile)
Create this validator using given xml file. |
|
AnnotationValidatorImpl(java.lang.String xmlConfigFile,
boolean setValueToNullIfEmptyString)
Creates this validator using given xml file. |
|
AnnotationValidatorImpl(java.lang.String xmlConfigFile,
boolean setValueToNullIfEmptyString,
boolean callConfigurationLoadedComplete)
Introduced which allows the control of when the extension's method 'configurationLoadingComplete' is called. |
|
| Method Summary | |
|---|---|
java.util.List<ValidationMessage> |
validateObject(java.lang.Object object)
Validates given object using the default primary group specified on ValidateDefinition. |
java.util.List<ValidationMessage> |
validateObject(java.lang.Object object,
java.lang.String group)
Validates given object for specified group, NOT recursive using a default path prefixing. |
java.util.List<ValidationMessage> |
validateObject(java.lang.Object object,
java.lang.String group,
boolean recurse)
Validates given object for specified group, either recursive or not using a default path prefixing. |
java.util.List |
validateObject(java.lang.Object object,
java.lang.String group,
boolean recurse,
JavalidValidationCallbackHandler callbackHandler)
Validates given object for specified group, either recursive or not using a default path prefixing. |
java.util.List |
validateObject(java.lang.Object object,
java.lang.String group,
JavalidValidationCallbackHandler callbackHandler)
Validates given object for specified group, NOT recursive using a default path prefixing. |
java.util.List<ValidationMessage> |
validateObject(java.lang.Object object,
java.lang.String group,
java.lang.String pathPrefix)
Validates given object for specified group using a special prefix (does not recurse). |
java.util.List<ValidationMessage> |
validateObject(java.lang.Object object,
java.lang.String group,
java.lang.String pathPrefix,
boolean recurse)
Validates given object for specified group using a special prefix and may recurse |
java.util.List<ValidationMessage> |
validateObject(java.lang.Object object,
java.lang.String group,
java.lang.String pathPrefix,
boolean recurse,
int levelDeep)
Validates given object for specified group using a special prefix and may recurse, if recurse is true levelDeep must be >= 1 |
java.util.List<ValidationMessage> |
validateObject(java.lang.Object object,
java.lang.String group,
java.lang.String pathPrefix,
boolean recurse,
int levelDeep,
JavalidValidationCallbackHandler callbackHandler)
Validates given object for specified group using a special prefix and may recurse, if recurse is true levelDeep must be >= 1. |
java.util.List |
validateObject(java.lang.Object object,
java.lang.String group,
java.lang.String pathPrefix,
boolean recurse,
JavalidValidationCallbackHandler callbackHandler)
Validates given object for specified group using a special prefix and may recurse |
java.util.List |
validateObject(java.lang.Object object,
java.lang.String group,
java.lang.String pathPrefix,
JavalidValidationCallbackHandler callbackHandler)
Validates given object for specified group using a special prefix (does not recurse). |
protected void |
validateObjectPriv(ValidatorParams params,
int currentLevelDeep,
java.lang.String currentPath,
JavalidValidationCallbackHandler callbackHandler,
java.util.List<ValidationMessage> messages)
The real validation method, which will recursively call itself until given parameters/constraints are met. |
java.util.List<ValidationMessage> |
validateProperty(java.lang.Object owningObject,
java.lang.String groupName,
java.lang.Object propertyValue,
java.lang.String propertyName,
java.lang.String pathPrefix)
This method allows validation for a single property. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected JvConfiguration jvConfig
protected AnnotationSupport annotationSupport
protected DebugSupport debugSupport
protected CacheSupport cacheSupport
protected JvConfigurationWrapper jvConfigWrapper
| Constructor Detail |
|---|
public AnnotationValidatorImpl()
public AnnotationValidatorImpl(java.lang.String xmlConfigFile)
xmlConfigFile - The config file to use
public AnnotationValidatorImpl(java.lang.String xmlConfigFile,
boolean setValueToNullIfEmptyString)
xmlConfigFile - The config file to usesetValueToNullIfEmptyString - Defaults to false, but if set to true when a String/StringBuffer value
to validate is encountered and they are EMPTY, they are set to null
instead of leaving it like "". It is recommended to use @NotEmpty annotation instead.
public AnnotationValidatorImpl(java.lang.String xmlConfigFile,
boolean setValueToNullIfEmptyString,
boolean callConfigurationLoadedComplete)
xmlConfigFile - The config file to usesetValueToNullIfEmptyString - Defaults to false, but if set to true when a String/StringBuffer value
to validate is encountered and they are EMPTY, they are set to null
instead of leaving it like "". It is recommended to use @NotEmpty annotation instead.callConfigurationLoadedComplete - | Method Detail |
|---|
public java.util.List<ValidationMessage> validateObject(java.lang.Object object)
AnnotationValidator
validateObject in interface AnnotationValidatorobject - The object to validate
public java.util.List<ValidationMessage> validateObject(java.lang.Object object,
java.lang.String group)
AnnotationValidator
validateObject in interface AnnotationValidatorobject - The object to validategroup - The group to validate
public java.util.List<ValidationMessage> validateObject(java.lang.Object object,
java.lang.String group,
boolean recurse)
AnnotationValidator
validateObject in interface AnnotationValidatorobject - The object to validategroup - The group to validaterecurse - True if you wish to recurse (default 1 level deep)
public java.util.List<ValidationMessage> validateObject(java.lang.Object object,
java.lang.String group,
java.lang.String pathPrefix)
AnnotationValidator
validateObject in interface AnnotationValidatorobject - The object to validategroup - The group to validatepathPrefix - The special path prefix to put before the normal object paths.
public java.util.List<ValidationMessage> validateObject(java.lang.Object object,
java.lang.String group,
java.lang.String pathPrefix,
boolean recurse)
AnnotationValidator
validateObject in interface AnnotationValidatorobject - The object to validategroup - The group to validatepathPrefix - The special path prefix to put before the normal object paths.recurse - True if you wish to recurse (1 level deep)
public java.util.List<ValidationMessage> validateObject(java.lang.Object object,
java.lang.String group,
java.lang.String pathPrefix,
boolean recurse,
int levelDeep)
AnnotationValidator
validateObject in interface AnnotationValidatorobject - The object to validategroup - The group to validatepathPrefix - The special path prefix to put before the normal object paths.recurse - True if you wish to recurselevelDeep - How deep the recursion should be, -1 for unlimited, otherwise >= 1. The recursion ends
when either levelDeep is reached or the instance working on does not have any getXXX methods
with JV group annotations anymore.
public java.util.List validateObject(java.lang.Object object,
java.lang.String group,
JavalidValidationCallbackHandler callbackHandler)
AnnotationValidator
validateObject in interface AnnotationValidatorobject - The object to validategroup - The group to validatecallbackHandler - Optional callbackhandler (any class that implements this interface). The framework will
then call the methods on this interface during validation. For details see the class
documentation itself.
JavalidValidationCallbackHandler
public java.util.List validateObject(java.lang.Object object,
java.lang.String group,
boolean recurse,
JavalidValidationCallbackHandler callbackHandler)
AnnotationValidator
validateObject in interface AnnotationValidatorobject - The object to validategroup - The group to validaterecurse - True if you wish to recurse (default 1 level deep)callbackHandler - Optional callbackhandler (any class that implements this interface). The framework will
then call the methods on this interface during validation. For details see the class
documentation itself.
JavalidValidationCallbackHandler
public java.util.List validateObject(java.lang.Object object,
java.lang.String group,
java.lang.String pathPrefix,
JavalidValidationCallbackHandler callbackHandler)
AnnotationValidator
validateObject in interface AnnotationValidatorobject - The object to validategroup - The group to validatepathPrefix - The special path prefix to put before the normal object paths.callbackHandler - Optional callbackhandler (any class that implements this interface). The framework will
then call the methods on this interface during validation. For details see the class
documentation itself.
JavalidValidationCallbackHandler
public java.util.List validateObject(java.lang.Object object,
java.lang.String group,
java.lang.String pathPrefix,
boolean recurse,
JavalidValidationCallbackHandler callbackHandler)
AnnotationValidator
validateObject in interface AnnotationValidatorobject - The object to validategroup - The group to validatepathPrefix - The special path prefix to put before the normal object paths.recurse - True if you wish to recurse (1 level deep)callbackHandler - Optional callbackhandler (any class that implements this interface). The framework will
then call the methods on this interface during validation. For details see the class
documentation itself.
JavalidValidationCallbackHandler
public java.util.List<ValidationMessage> validateObject(java.lang.Object object,
java.lang.String group,
java.lang.String pathPrefix,
boolean recurse,
int levelDeep,
JavalidValidationCallbackHandler callbackHandler)
AnnotationValidator
validateObject in interface AnnotationValidatorobject - The object to validategroup - The group to validatepathPrefix - The special path prefix to put before the normal object paths.recurse - True if you wish to recurselevelDeep - How deep the recursion should be, -1 for unlimited, otherwise >= 1. The recursion ends
when either levelDeep is reached or the instance working on does not have any getXXX methods
with JV group annotations anymore.callbackHandler - Optional callbackhandler (any class that implements this interface). The framework will
then call the methods on this interface during validation. For details see the class
documentation itself.
JavalidValidationCallbackHandler
public java.util.List<ValidationMessage> validateProperty(java.lang.Object owningObject,
java.lang.String groupName,
java.lang.Object propertyValue,
java.lang.String propertyName,
java.lang.String pathPrefix)
AnnotationValidatorThe owning object represents where the property is from (thus owningObject.propertyName together denotes the method under validation). The owning object is used to determine if validation is allowed what is supported etc. However other than for information the owningObject is not used (thus no method is called on it, instead we rely on propertyValue to validate that).
validateProperty in interface AnnotationValidatorowningObject - The owning objectgroupName - Groupname we wish to validate for this propertypropertyValue - The actual value to validatepropertyName - The name of the property (is a methodname from the owningObject, we use that to determine
what validations must be processed on propertyValue), thus firstName is turned into getFirstName.pathPrefix - The prefix to use in the path, in this case it must be the full expression EXCLUDING the propertyName
but it should include owningObject's path (where it was from), e.g. in jsf: backingBean.person where
backingBean is the name of the jsf bean, and person matches our owningObject.
protected void validateObjectPriv(ValidatorParams params,
int currentLevelDeep,
java.lang.String currentPath,
JavalidValidationCallbackHandler callbackHandler,
java.util.List<ValidationMessage> messages)
params - The non-changing parameters (static)currentLevelDeep - The current level of recursion, 1 is the start level.currentPath - The current path of the object, if a method on given object is validated and contains
an error the error path would be: currentPath.methodName (e.g. examplePath.example)messages - The list of messages to append new messages to
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||