public abstract class BaseParserValidator<T> extends Object implements ParserValidator<T>
Modifier and Type | Field and Description |
---|---|
protected static String |
LEFT_PARAM_DELIMITER |
protected String |
model |
protected static String |
PARAMETER_REGEXP |
protected static String |
RIGHT_PARAM_DELIMITER |
protected ModelType |
type
The name of the parser type, e.g., BOOLEAN, INTEGER, etc
|
protected String |
typeRegexp
The regexp which defines the allowed model expression.
|
Modifier | Constructor and Description |
---|---|
protected |
BaseParserValidator(String model,
ModelType type)
Construct a parser validator whose model definition should match the parser type (case insensitive)
|
protected |
BaseParserValidator(String model,
ModelType type,
String typeRegexp)
Construct a parser validator with a customized model definition rule.
|
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 Class<?> |
getClassType()
Returns the class used by this parser to convert string parameter values.
|
static String |
ignoreCaseQuotedRegexp(String matcher) |
static String |
ignoreCaseRegexp(String matcher) |
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,
boolean isVariableHidden)
Parses/converts and validate the given value
|
protected static final String LEFT_PARAM_DELIMITER
protected static final String RIGHT_PARAM_DELIMITER
protected static final String PARAMETER_REGEXP
protected String model
protected ModelType type
protected String typeRegexp
protected BaseParserValidator(String model, ModelType type) throws ModelSyntaxException
model
- the model definitiontype
- the parser typeModelSyntaxException
protected BaseParserValidator(String model, ModelType type, String typeRegexp) throws ModelSyntaxException
model
- the model definitiontype
- the parser typetypeRegexp
- the expected pattern of the model expressionModelSyntaxException
protected 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, boolean isVariableHidden) throws ConversionException, ValidationException, ModelSyntaxException
ParserValidator
parseAndValidate
in interface ParserValidator<T>
parameterValue
- value to parse and validatecontext
- a context for this validationisVariableHidden
- true if the variable is hiddenConversionException
- if an error occurred during the conversionValidationException
- if an error occurred during the validationModelSyntaxException