Package org.nuiton.validator
Interface NuitonValidatorProvider
- All Known Implementing Classes:
AbstractNuitonValidatorProvider,XWork2NuitonValidatorProvider
public interface NuitonValidatorProvider
Provider of
NuitonValidator.
An implementation of a such class provides a implementation of a validator models
and also of validator.
Note: Providers are used in the NuitonValidatorFactory and
should be registered via the ServiceLoader api.- Since:
- 2.0
- Author:
- Tony Chemit - chemit@codelutin.com
- See Also:
NuitonValidatorModel,NuitonValidator,ServiceLoader
-
Method Summary
Modifier and Type Method Description java.util.SortedSet<NuitonValidator<?>>detectValidators(java.io.File sourceRoot, java.util.regex.Pattern contextFilter, NuitonValidatorScope[] scopes, java.lang.Class<?>... types)Detects in the given directory validators.<O> NuitonValidatorModel<O>getModel(java.lang.Class<O> type, java.lang.String context, NuitonValidatorScope... scopes)Obtain a validator model, the model should be cached and not be reinstanciated at each time a validator model is asked.java.lang.StringgetName()Obtains the name of the provider.<O> NuitonValidatorModel<O>newModel(java.lang.Class<O> type, java.lang.String context, NuitonValidatorScope... scopes)Instanciate a new validator model for the given parameters.<O> NuitonValidator<O>newValidator(NuitonValidatorModel<O> model)Obtains a new validator for the givenmodel.
-
Method Details
-
getName
java.lang.String getName()Obtains the name of the provider.- Returns:
- the name of the provider.
-
getModel
<O> NuitonValidatorModel<O> getModel(java.lang.Class<O> type, java.lang.String context, NuitonValidatorScope... scopes)Obtain a validator model, the model should be cached and not be reinstanciated at each time a validator model is asked.- Type Parameters:
O- type of the class to validate- Parameters:
type- type of the class to validatecontext- context of validation (nullif no context)scopes- filtered scope (if nothing given, then use all scopes)- Returns:
- the cached model of validation
-
newModel
<O> NuitonValidatorModel<O> newModel(java.lang.Class<O> type, java.lang.String context, NuitonValidatorScope... scopes)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 (nullif no context)scopes- filtered scope (if nothing given, then use all scopes)- Returns:
- the new instanciated model of validation
-
newValidator
Obtains a new validator for the givenmodel.- Type Parameters:
O- type of class to validate- Parameters:
model- the model of validator to use- Returns:
- the new validator
-
detectValidators
java.util.SortedSet<NuitonValidator<?>> detectValidators(java.io.File sourceRoot, java.util.regex.Pattern contextFilter, NuitonValidatorScope[] scopes, java.lang.Class<?>... types)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
-