public abstract class BaseParserValidator<T> extends Object implements ParserValidator<T>
Modifier | Constructor and Description |
---|---|
protected |
BaseParserValidator(String model) |
Modifier and Type | Method and Description |
---|---|
protected abstract Converter<T> |
createConverter(String model)
Create a converter used by this parser
|
protected abstract Validator<T> |
createValidator(String model,
Converter<T> converter)
Create a validator used by this parser, using eventually a converter
|
protected abstract Class |
getClassType()
Returns the class used by this parser to convert string parameter values.
|
protected abstract String |
getType()
Return the name of the parser type
|
protected abstract String |
getTypeRegexp()
Returns a model regexp able to match the parser type.
|
protected String |
parseAndGetOneGroup(String valueToParse,
String regexp) |
protected static List<String> |
parseAndGetRegexGroups(String valueToParse,
String regexp) |
T |
parseAndValidate(String parameterValue)
Parses/converts and validate the given value
|
T |
parseAndValidate(String parameterValue,
ModelValidatorContext context)
Parses/converts and validate the given value
|
protected String model
protected BaseParserValidator(String model) throws ModelSyntaxException
ModelSyntaxException
protected abstract String getType()
protected abstract String getTypeRegexp()
protected abstract Class getClassType()
protected abstract Converter<T> createConverter(String model) throws ModelSyntaxException
model
- model used to create the converterModelSyntaxException
protected abstract Validator<T> createValidator(String model, Converter<T> converter) throws ModelSyntaxException
model
- model used to create the validatorconverter
- converter eventually used to create the validatorModelSyntaxException
protected String parseAndGetOneGroup(String valueToParse, String regexp) throws ModelSyntaxException
ModelSyntaxException
protected static List<String> parseAndGetRegexGroups(String valueToParse, String regexp) throws ModelSyntaxException
ModelSyntaxException
public T parseAndValidate(String parameterValue) throws ConversionException, ValidationException, ModelSyntaxException
ParserValidator
parseAndValidate
in interface ParserValidator<T>
parameterValue
- value to parse and validateConversionException
- if an error occurred during the conversionValidationException
- if an error occurred during the validationModelSyntaxException
public T parseAndValidate(String parameterValue, ModelValidatorContext context) throws ConversionException, ValidationException, ModelSyntaxException
ParserValidator
parseAndValidate
in interface ParserValidator<T>
parameterValue
- value to parse and validatecontext
- a context for this validationConversionException
- if an error occurred during the conversionValidationException
- if an error occurred during the validationModelSyntaxException