org.nuiton.validator.xwork2
Class XWork2NuitonValidatorProvider
java.lang.Object
org.nuiton.validator.AbstractNuitonValidatorProvider
org.nuiton.validator.xwork2.XWork2NuitonValidatorProvider
- All Implemented Interfaces:
- NuitonValidatorProvider
public class XWork2NuitonValidatorProvider
- extends AbstractNuitonValidatorProvider
Provider of validator for the xworks nuiton validator.
- Since:
- 2.0
- Author:
- tchemit
|
Method Summary |
SortedSet<NuitonValidator<?>> |
detectValidators(File sourceRoot,
Pattern contextFilter,
NuitonValidatorScope[] scopes,
Class<?>... types)
Detects in the given directory validators. |
protected File |
getClassDir(File sourceRoot,
Class<?> clazz)
|
protected String[] |
getContexts(Class<?> clazz,
File dir)
|
protected String[] |
getContextsWithoutScopes(String[] contexts)
|
protected String[] |
getFilterContexts(Pattern contextFilter,
String[] realContexts)
|
protected
|
getValidator(Class<O> klass,
String context,
NuitonValidatorScope... scopes)
Pour un context et un type d'entité donné, instancie un validateur et
test si ce validateur est utilisable (i.e qu'il admet des champs à
valider). |
|
newModel(Class<O> type,
String context,
NuitonValidatorScope... scopes)
Instanciate a new validator model for the given parameters. |
|
newValidator(NuitonValidatorModel<O> model)
Obtains a new validator for the given model. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PROVIDER_NAME
public static final String PROVIDER_NAME
- See Also:
- Constant Field Values
XWork2NuitonValidatorProvider
public XWork2NuitonValidatorProvider()
newModel
public <O> NuitonValidatorModel<O> newModel(Class<O> type,
String context,
NuitonValidatorScope... scopes)
- Description copied from interface:
NuitonValidatorProvider
- Instanciate a new validator model for the given parameters.
- Type Parameters:
O - type of the class to validate- Parameters:
type - type of the class to validatecontext - context of validation (null if no context)scopes - filtered scope (if nothing given, then use all scopes)
- Returns:
- the new instanciated model of validation
newValidator
public <O> XWork2NuitonValidator<O> newValidator(NuitonValidatorModel<O> model)
- Description copied from interface:
NuitonValidatorProvider
- Obtains a new validator for the given
model.
- Type Parameters:
O - type of class to validate- Parameters:
model - the model of validator to use
- Returns:
- the new validator
detectValidators
public SortedSet<NuitonValidator<?>> detectValidators(File sourceRoot,
Pattern contextFilter,
NuitonValidatorScope[] scopes,
Class<?>... types)
- Description copied from interface:
NuitonValidatorProvider
- Detects in the given directory validators.
- Parameters:
sourceRoot - root directory where to seek for validatorscontextFilter - the pattern of context to seekscopes - scopes to seek (if none given, will seek for all scopes)types - types of class to seek
- Returns:
- the set of validators found
getValidator
protected <O> NuitonValidator<O> getValidator(Class<O> klass,
String context,
NuitonValidatorScope... scopes)
- Pour un context et un type d'entité donné, instancie un validateur et
test si ce validateur est utilisable (i.e qu'il admet des champs à
valider).
Si aucun champ n'est trouvé dans le validateur, alors on retourne null.
- Type Parameters:
O - le type du bean- Parameters:
klass - le type du beancontext - le context du validateurscopes - les scopes a utiliser (si null alors pas de
filtre sur les scopes)
- Returns:
- le validateur initialisé, ou
null si aucun scope
détecté dans le validateur.
getClassDir
protected File getClassDir(File sourceRoot,
Class<?> clazz)
getContexts
protected String[] getContexts(Class<?> clazz,
File dir)
getContextsWithoutScopes
protected String[] getContextsWithoutScopes(String[] contexts)
getFilterContexts
protected String[] getFilterContexts(Pattern contextFilter,
String[] realContexts)
Copyright © 2011-2012 CodeLutin. All Rights Reserved.