@Immutable public class DataTypeGrammarParser extends Object
DataTypeGrammarParser.DataTypePattern for a grammar, where the DataTypeGrammarParser.DataTypePattern can
be used when parsing content containing data types adhering to the grammar(s).
The grammar using the following rules:
keyword or word tokens are considered literals that much
be matched case-insensitively but completely.keyword or word tokens are considered logical names of
a variable and will match and single token.L (or mantissa, M) is specified with '(L)' or '(M)', or if coupled with a scale,
S, with '(L,S)' or '(M,D)'. In these cases, the length will match any positive long, and scale will match any integer
value. When the length or scale are represented with integers, they will match only those values...., in which case the parser will allow (but not capture) a list of values.{n}' signals that the grammar can allow array dimensions at this point.For example, the following are valid data type grammars:
BITBIT(3) will match when the length is exactly 3 and will not match BIT(2).DECIMAL(L[,S]) will match DECIMAL(5) and DECIMAL (10,3)INTEGER{n} will match INTEGER[3], which is an array of integers.
ENUM(...) will match ENUM(a,b,c,d) and ENUM(a).
DataTypeParser| Modifier and Type | Class and Description |
|---|---|
protected static class |
DataTypeGrammarParser.AndPattern |
protected static class |
DataTypeGrammarParser.ArrayDimensionsPattern |
protected static class |
DataTypeGrammarParser.DataTypeBuilder |
static class |
DataTypeGrammarParser.DataTypePattern |
protected static class |
DataTypeGrammarParser.LengthPattern |
protected static class |
DataTypeGrammarParser.ListPattern |
protected static class |
DataTypeGrammarParser.LiteralLengthPattern |
protected static class |
DataTypeGrammarParser.LiteralPattern |
protected static class |
DataTypeGrammarParser.LiteralScalePattern |
protected static class |
DataTypeGrammarParser.OptionalPattern |
protected static class |
DataTypeGrammarParser.OrPattern |
protected static interface |
DataTypeGrammarParser.Pattern |
protected static class |
DataTypeGrammarParser.ScalePattern |
protected static class |
DataTypeGrammarParser.VariablePattern |
| Modifier and Type | Field and Description |
|---|---|
private DdlTokenizer |
tokenizer |
| Constructor and Description |
|---|
DataTypeGrammarParser()
Create a new instance of the data type grammar parser.
|
| Modifier and Type | Method and Description |
|---|---|
DataTypeGrammarParser.DataTypePattern |
parse(int jdbcType,
String dataTypeDefn)
Parse the supplied grammar for a data type.
|
protected DataTypeGrammarParser.Pattern |
parseArrayDimensions(TokenStream stream) |
protected DataTypeGrammarParser.Pattern |
parseLength(TokenStream stream) |
protected DataTypeGrammarParser.Pattern |
parseLengthLiteral(TokenStream stream) |
protected DataTypeGrammarParser.Pattern |
parseMultiple(TokenStream stream) |
protected DataTypeGrammarParser.Pattern |
parseOptional(TokenStream stream,
Function<TokenStream,DataTypeGrammarParser.Pattern> inside) |
protected DataTypeGrammarParser.Pattern |
parsePattern(TokenStream stream) |
protected DataTypeGrammarParser.Pattern |
parseScale(TokenStream stream) |
protected DataTypeGrammarParser.Pattern |
parseScaleLiteral(TokenStream stream) |
private final DdlTokenizer tokenizer
public DataTypeGrammarParser()
public DataTypeGrammarParser.DataTypePattern parse(int jdbcType, String dataTypeDefn) throws ParsingException
jdbcType - the JDBC data typedataTypeDefn - the data type grammarParsingException - if the grammar cannot be parsed correctlyprotected DataTypeGrammarParser.Pattern parseMultiple(TokenStream stream) throws ParsingException
ParsingExceptionprotected DataTypeGrammarParser.Pattern parsePattern(TokenStream stream) throws ParsingException
ParsingExceptionprotected DataTypeGrammarParser.Pattern parseOptional(TokenStream stream, Function<TokenStream,DataTypeGrammarParser.Pattern> inside) throws ParsingException
ParsingExceptionprotected DataTypeGrammarParser.Pattern parseArrayDimensions(TokenStream stream) throws ParsingException
ParsingExceptionprotected DataTypeGrammarParser.Pattern parseLength(TokenStream stream) throws ParsingException
ParsingExceptionprotected DataTypeGrammarParser.Pattern parseScale(TokenStream stream) throws ParsingException
ParsingExceptionprotected DataTypeGrammarParser.Pattern parseLengthLiteral(TokenStream stream) throws ParsingException
ParsingExceptionprotected DataTypeGrammarParser.Pattern parseScaleLiteral(TokenStream stream) throws ParsingException
ParsingExceptionCopyright © 2016 JBoss by Red Hat. All rights reserved.