Package org.nuiton.validator
Class NuitonValidatorFactory
- java.lang.Object
-
- org.nuiton.validator.NuitonValidatorFactory
-
public class NuitonValidatorFactory extends Object
Factory to obtain new validators. The factory contains a cache ofNuitonValidatorModel
. To obtain a new validator with no context, use this code :NuitonValidator<O> validator = NuitonValidatorFactory.newValidator(O.class);
- Since:
- 2.0
- Author:
- Tony Chemit - chemit@codelutin.com
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
defaultProviderName
protected static Map<String,NuitonValidatorProvider>
providers
-
Constructor Summary
Constructors Modifier Constructor Description protected
NuitonValidatorFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static NuitonValidatorProvider
getDefaultProvider()
static String
getDefaultProviderName()
static NuitonValidatorProvider
getProvider(String providerName)
static Map<String,NuitonValidatorProvider>
getProviders()
static <O> NuitonValidator<O>
newValidator(Class<O> type, String context, NuitonValidatorScope... scopes)
static <O> NuitonValidator<O>
newValidator(Class<O> type, NuitonValidatorScope... scopes)
static <O> NuitonValidator<O>
newValidator(String providerName, Class<O> type, String context, NuitonValidatorScope... scopes)
static void
setDefaultProviderName(String defaultProviderName)
-
-
-
Field Detail
-
defaultProviderName
protected static String defaultProviderName
-
providers
protected static Map<String,NuitonValidatorProvider> providers
-
-
Method Detail
-
newValidator
public static <O> NuitonValidator<O> newValidator(Class<O> type, NuitonValidatorScope... scopes)
-
newValidator
public static <O> NuitonValidator<O> newValidator(Class<O> type, String context, NuitonValidatorScope... scopes)
-
newValidator
public static <O> NuitonValidator<O> newValidator(String providerName, Class<O> type, String context, NuitonValidatorScope... scopes) throws NullPointerException
- Throws:
NullPointerException
-
getProviders
public static Map<String,NuitonValidatorProvider> getProviders()
-
getProvider
public static NuitonValidatorProvider getProvider(String providerName) throws IllegalArgumentException, NullPointerException
-
getDefaultProvider
public static NuitonValidatorProvider getDefaultProvider()
-
getDefaultProviderName
public static String getDefaultProviderName() throws IllegalStateException
- Throws:
IllegalStateException
-
setDefaultProviderName
public static void setDefaultProviderName(String defaultProviderName) throws IllegalArgumentException, NullPointerException
-
-