Package org.apache.calcite.sql.parser
Class SqlAbstractParserImpl.MetadataImpl
- java.lang.Object
-
- org.apache.calcite.sql.parser.SqlAbstractParserImpl.MetadataImpl
-
- All Implemented Interfaces:
SqlAbstractParserImpl.Metadata
- Enclosing class:
- SqlAbstractParserImpl
public static class SqlAbstractParserImpl.MetadataImpl extends java.lang.Object implements SqlAbstractParserImpl.Metadata
Default implementation of theSqlAbstractParserImpl.Metadata
interface.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<java.lang.String>
contextVariableNames
private java.util.Set<java.lang.String>
nonReservedKeyWordSet
private java.util.Set<java.lang.String>
reservedFunctionNames
private java.util.Set<java.lang.String>
reservedWords
private java.lang.String
sql92ReservedWords
private java.util.List<java.lang.String>
tokenList
Immutable list of all tokens, in alphabetical order.private java.util.SortedSet<java.lang.String>
tokenSet
Set of all tokens.
-
Constructor Summary
Constructors Constructor Description MetadataImpl(SqlAbstractParserImpl sqlParser)
Creates a MetadataImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.String
constructSql92ReservedWordList()
Builds a comma-separated list of JDBC reserved words.java.lang.String
getJdbcKeywords()
Returns comma-separated list of JDBC keywords.java.util.List<java.lang.String>
getTokens()
Returns a list of all tokens in alphabetical order.private void
initList(SqlAbstractParserImpl parserImpl, java.util.Set<java.lang.String> keywords, java.lang.String name)
Initializes lists of keywords.boolean
isContextVariableName(java.lang.String token)
Returns whether token is the name of a context variable such as "CURRENT_USER".boolean
isKeyword(java.lang.String token)
Returns whether token is a keyword.boolean
isNonReservedKeyword(java.lang.String token)
Returns true if token is a keyword but not a reserved word.boolean
isReservedFunctionName(java.lang.String token)
Returns whether token is a reserved function name such as "CURRENT_USER".boolean
isReservedWord(java.lang.String token)
Returns whether token is a reserved word.boolean
isSql92ReservedWord(java.lang.String token)
Returns whether token is a reserved word as specified by the SQL:92 standard.private java.lang.Object
virtualCall(SqlAbstractParserImpl parserImpl, java.lang.String name)
Uses reflection to invoke a method on this parser.
-
-
-
Field Detail
-
reservedFunctionNames
private final java.util.Set<java.lang.String> reservedFunctionNames
-
contextVariableNames
private final java.util.Set<java.lang.String> contextVariableNames
-
nonReservedKeyWordSet
private final java.util.Set<java.lang.String> nonReservedKeyWordSet
-
tokenSet
private final java.util.SortedSet<java.lang.String> tokenSet
Set of all tokens.
-
tokenList
private final java.util.List<java.lang.String> tokenList
Immutable list of all tokens, in alphabetical order.
-
reservedWords
private final java.util.Set<java.lang.String> reservedWords
-
sql92ReservedWords
private final java.lang.String sql92ReservedWords
-
-
Constructor Detail
-
MetadataImpl
public MetadataImpl(SqlAbstractParserImpl sqlParser)
Creates a MetadataImpl.- Parameters:
sqlParser
- Parser
-
-
Method Detail
-
initList
private void initList(SqlAbstractParserImpl parserImpl, java.util.Set<java.lang.String> keywords, java.lang.String name)
Initializes lists of keywords.
-
virtualCall
private java.lang.Object virtualCall(SqlAbstractParserImpl parserImpl, java.lang.String name) throws java.lang.Throwable
Uses reflection to invoke a method on this parser. The method must be public and have no parameters.- Parameters:
parserImpl
- Parsername
- Name of method. For example "ReservedFunctionName".- Returns:
- Result of calling method
- Throws:
java.lang.Throwable
-
constructSql92ReservedWordList
private java.lang.String constructSql92ReservedWordList()
Builds a comma-separated list of JDBC reserved words.
-
getTokens
public java.util.List<java.lang.String> getTokens()
Description copied from interface:SqlAbstractParserImpl.Metadata
Returns a list of all tokens in alphabetical order.- Specified by:
getTokens
in interfaceSqlAbstractParserImpl.Metadata
-
isSql92ReservedWord
public boolean isSql92ReservedWord(java.lang.String token)
Description copied from interface:SqlAbstractParserImpl.Metadata
Returns whether token is a reserved word as specified by the SQL:92 standard.- Specified by:
isSql92ReservedWord
in interfaceSqlAbstractParserImpl.Metadata
-
getJdbcKeywords
public java.lang.String getJdbcKeywords()
Description copied from interface:SqlAbstractParserImpl.Metadata
Returns comma-separated list of JDBC keywords.- Specified by:
getJdbcKeywords
in interfaceSqlAbstractParserImpl.Metadata
-
isKeyword
public boolean isKeyword(java.lang.String token)
Description copied from interface:SqlAbstractParserImpl.Metadata
Returns whether token is a keyword. (That is, a non-reserved keyword, a context variable, or a reserved function name.)- Specified by:
isKeyword
in interfaceSqlAbstractParserImpl.Metadata
-
isNonReservedKeyword
public boolean isNonReservedKeyword(java.lang.String token)
Description copied from interface:SqlAbstractParserImpl.Metadata
Returns true if token is a keyword but not a reserved word. For example, "KEY".- Specified by:
isNonReservedKeyword
in interfaceSqlAbstractParserImpl.Metadata
-
isReservedFunctionName
public boolean isReservedFunctionName(java.lang.String token)
Description copied from interface:SqlAbstractParserImpl.Metadata
Returns whether token is a reserved function name such as "CURRENT_USER".- Specified by:
isReservedFunctionName
in interfaceSqlAbstractParserImpl.Metadata
-
isContextVariableName
public boolean isContextVariableName(java.lang.String token)
Description copied from interface:SqlAbstractParserImpl.Metadata
Returns whether token is the name of a context variable such as "CURRENT_USER".- Specified by:
isContextVariableName
in interfaceSqlAbstractParserImpl.Metadata
-
isReservedWord
public boolean isReservedWord(java.lang.String token)
Description copied from interface:SqlAbstractParserImpl.Metadata
Returns whether token is a reserved word.- Specified by:
isReservedWord
in interfaceSqlAbstractParserImpl.Metadata
-
-