|
|||||||||
| 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.
| Field Summary | |
|---|---|
protected CacheSupport |
cacheSupport
|
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 callConfigurationLoadedComplete)
Introduced with 1.1 which allows the control of when the extension's method 'configurationLoadingComplete' is called. |
protected |
AnnotationValidatorImpl(java.lang.String xmlConfigFile,
java.net.URL urlConfigFile,
boolean callConfigurationLoadedComplete)
Protected constructor called by the others which does the actual work (one of configs must be set) |
|
AnnotationValidatorImpl(java.net.URL urlConfigFile)
Constructs this validator using given urlConfigFile. |
|
AnnotationValidatorImpl(java.net.URL urlConfigFile,
boolean callConfigurationLoadedComplete)
Allows the control of when the extension's method 'configurationLoadingComplete' is called. |
| Method Summary | |
|---|---|
LocaleResolver |
getLocaleResolver()
Returns the current locale resolver in use (which is the default implementation if not set). |
MessageCodeResolver |
getMessageCodeResolver()
Returns the current MessageCodeResolver in use (which is the default implementation if not set). |
boolean |
isMessageResolvingEnabled()
Returns true if automatic message resolving is enabled |
void |
setLocaleResolver(LocaleResolver localeResolver)
Overrides and sets a new LocaleResolver to be used by the framework. |
void |
setMessageCodeResolver(MessageCodeResolver messageCodeResolver)
Overrides and sets a new MessageCodeResolver |
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 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 callConfigurationLoadedComplete)
xmlConfigFile - The config file to usecallConfigurationLoadedComplete - Set to true if a call after configuration must be sent to extensions (default is true)public AnnotationValidatorImpl(java.net.URL urlConfigFile)
urlConfigFile - The config file to use (as an url so it can point to nearly everything)
public AnnotationValidatorImpl(java.net.URL urlConfigFile,
boolean callConfigurationLoadedComplete)
urlConfigFile - The config file to use (as an url so it can point to nearly everything)callConfigurationLoadedComplete - Set to true if a call after configuration must be sent to extensions (default is true)
protected AnnotationValidatorImpl(java.lang.String xmlConfigFile,
java.net.URL urlConfigFile,
boolean callConfigurationLoadedComplete)
xmlConfigFile - Xml config fileurlConfigFile - Url config filecallConfigurationLoadedComplete - Set to true if a call after configuration must be sent to extensions (default is true)| 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.
public void setLocaleResolver(LocaleResolver localeResolver)
AnnotationValidator
setLocaleResolver in interface AnnotationValidatorlocaleResolver - The resolver to usepublic LocaleResolver getLocaleResolver()
AnnotationValidatorNote that the default implementation is not threadsafe as for setting a new Locale (in other words its best to do this when initializing the validator or set your own LocaleResolver instead).
getLocaleResolver in interface AnnotationValidatorpublic MessageCodeResolver getMessageCodeResolver()
AnnotationValidator
getMessageCodeResolver in interface AnnotationValidatorpublic void setMessageCodeResolver(MessageCodeResolver messageCodeResolver)
AnnotationValidator
setMessageCodeResolver in interface AnnotationValidatormessageCodeResolver - New message code resolverpublic boolean isMessageResolvingEnabled()
AnnotationValidator
isMessageResolvingEnabled in interface AnnotationValidator
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.callbackHandler - Callback handler to be called during validationcurrentPath - 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 | ||||||||