public abstract class AbstractSchemaParser<T extends SchemaObject> extends Object
Modifier and Type | Field and Description |
---|---|
protected ReusableAntlrSchemaLexer |
lexer
the antlr generated lexer being wrapped
|
protected static org.slf4j.Logger |
LOG
The LoggerFactory used by this class
|
protected ParserMonitor |
monitor
the monitor to use for this parser
|
protected ReusableAntlrSchemaParser |
parser
the antlr generated parser being wrapped
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractSchemaParser(Class<T> schemaObjectType,
I18n errorCodeOnNull,
I18n errorCodeOnParseExceptionWithPosition,
I18n errorCodeOnParseException)
Instantiates a new abstract schema parser.
|
Modifier and Type | Method and Description |
---|---|
protected abstract T |
doParse()
Parse a SchemaObject description and returns back an instance of SchemaObject.
|
boolean |
isQuirksMode()
Checks if quirks mode is enabled.
|
T |
parse(String schemaDescription)
Parse a SchemaObject description and returns back an instance of SchemaObject.
|
protected void |
reset(String spec)
Initializes the plumbing by creating a pipe and coupling the parser/lexer
pair with it.
|
void |
setParserMonitor(ParserMonitor parserMonitor)
Sets the parser monitor.
|
void |
setQuirksMode(boolean enabled)
Sets the quirks mode.
|
protected static final org.slf4j.Logger LOG
protected ParserMonitor monitor
protected ReusableAntlrSchemaParser parser
protected ReusableAntlrSchemaLexer lexer
protected AbstractSchemaParser(Class<T> schemaObjectType, I18n errorCodeOnNull, I18n errorCodeOnParseExceptionWithPosition, I18n errorCodeOnParseException)
errorCodeOnNull
- error code used when schema element is nullerrorCodeOnParseExceptionWithPosition
- error code used on parse error when position is knownerrorCodeOnParseException
- error code used on parse error when position is unknownprotected void reset(String spec)
spec
- the specpublic void setParserMonitor(ParserMonitor parserMonitor)
parserMonitor
- the new parser monitorpublic void setQuirksMode(boolean enabled)
enabled
- the new quirks modepublic boolean isQuirksMode()
public T parse(String schemaDescription) throws ParseException
schemaDescription
- The SchemaObject descriptionParseException
- If the parsing failedprotected abstract T doParse() throws antlr.RecognitionException, antlr.TokenStreamException
antlr.RecognitionException
- the native antlr exceptionantlr.TokenStreamException
- the native antlr exceptionCopyright © 2003–2015 The Apache Software Foundation. All rights reserved.