public abstract class AbstractSchemaParser<T extends SchemaObject>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private I18n |
errorCodeOnNull
error code used when schema descritpion is null
|
private I18n |
errorCodeOnParseException
error code used on parse error when position is unknown
|
private I18n |
errorCodeOnParseExceptionWithPosition
error code used on parse error when position is known
|
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
|
private java.lang.Class<T> |
schemaObjectType
the schema object sub-type
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSchemaParser(java.lang.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(java.lang.String schemaDescription)
Parse a SchemaObject description and returns back an instance of SchemaObject.
|
protected void |
reset(java.lang.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.
|
private void |
updateSchemaName(SchemaObject schemaObject)
Update the schemaName for the given SchemaObject, accordingly to the X-SCHEMA parameter.
|
private java.text.ParseException |
wrapRecognitionException(java.lang.String schemaDescription,
antlr.RecognitionException re) |
private java.text.ParseException |
wrapTokenStreamException(java.lang.String schemaDescription,
antlr.TokenStreamException tse) |
protected static final org.slf4j.Logger LOG
protected ParserMonitor monitor
protected ReusableAntlrSchemaParser parser
protected ReusableAntlrSchemaLexer lexer
private java.lang.Class<T extends SchemaObject> schemaObjectType
private I18n errorCodeOnNull
private I18n errorCodeOnParseExceptionWithPosition
private I18n errorCodeOnParseException
protected AbstractSchemaParser(java.lang.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(java.lang.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(java.lang.String schemaDescription) throws java.text.ParseException
schemaDescription - The SchemaObject descriptionjava.text.ParseException - If the parsing failedprivate java.text.ParseException wrapRecognitionException(java.lang.String schemaDescription,
antlr.RecognitionException re)
private java.text.ParseException wrapTokenStreamException(java.lang.String schemaDescription,
antlr.TokenStreamException tse)
protected abstract T doParse() throws antlr.RecognitionException, antlr.TokenStreamException
antlr.RecognitionException - the native antlr exceptionantlr.TokenStreamException - the native antlr exceptionprivate void updateSchemaName(SchemaObject schemaObject)
schemaObject - the schema object where the name should be updated