Top Description Fields Constructors Methods
org.hibernate.sql.ordering.antlr

public Class OrderByFragmentParser

extends GeneratedOrderByFragmentParser
Class Inheritance
Imports
java.util.ArrayList, .HashSet, .Set, java.util.regex.Matcher, .Pattern, org.hibernate.dialect.function.SQLFunction, org.hibernate.internal.util.StringHelper, org.hibernate.sql.Template, org.jboss.logging.Logger, antlr.CommonAST, .TokenStream, antlr.collections.AST

Extension of the Antlr-generated parser for the purpose of adding our custom parsing behavior (semantic analysis, etc).
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private Set<String>
private final TranslationContext
private static final Logger
private static final int
private int
Inherited from org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser:
_tokenNames_tokenSet_0_tokenSet_1_tokenSet_2_tokenSet_3_tokenSet_4_tokenSet_5_tokenSet_6_tokenSet_7_tokenSet_8_tokenSet_9

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private String
private SortSpecification
createSortSpecification(AST ident, CollationSpecification collationSpecification, OrderingSpecification orderingSpecification)

public Set<String>
protected boolean
isFunctionName(AST
The node whose text we want to check.
ast
)

Overrides org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.isFunctionName.

A check to see if the text of the given node represents a known function name.
private static boolean
private String
protected AST
postProcessSortSpecification(AST
The grammar-built sort specification subtree.
sortSpec
)

Overrides org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.postProcessSortSpecification.

Allow post processing of each sort specification
private AST
protected AST
quotedIdentifier(AST
The quoted-identifier node.
ident
)

Overrides org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.quotedIdentifier.

Process the given node as a quote identifier.
protected AST
quotedString(AST
The quoted string. This is used from within function param recognition, and represents a SQL-quoted string.
ident
)

Overrides org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.quotedString.

Process the given node as a quote string.
protected AST
resolveFunction(AST
The node representing the function invocation (including parameters as subtree components).
ast
)

Overrides org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.resolveFunction.

Process the given node as a function.
private String
protected AST
resolveIdent(AST
The node whose text represents either a column or property reference.
ident
)

Overrides org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.resolveIdent.

Process the given node as an IDENT.
protected void
trace(String
The trace message.
msg
)

Overrides org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.trace.

Method for logging execution trace information.
public void
public void
Inherited from org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser:
buildTokenTypeASTClassMapcollationNamecollationSpecificationexpressionextractTextfunctionCallfunctionCallCheckfunctionNamefunctionParameterfunctionParameterListnullOrderingnullPrecedenceorderByFragmentorderingSpecificationsimplePropertyPathsortKeysortSpecification

Field Detail

columnReferencesback to summary
private Set<String> columnReferences
contextback to summary
private final TranslationContext context
LOGback to summary
private static final Logger LOG
TEMPLATE_MARKER_LENGTHback to summary
private static final int TEMPLATE_MARKER_LENGTH
traceDepthback to summary
private int traceDepth

Hides antlr.Parser.traceDepth.

Constructor Detail

OrderByFragmentParserback to summary
public OrderByFragmentParser(TokenStream lexer, TranslationContext context)

Method Detail

adjustTemplateReferencesback to summary
private String adjustTemplateReferences(String template)
createSortSpecificationback to summary
private SortSpecification createSortSpecification(AST ident, CollationSpecification collationSpecification, OrderingSpecification orderingSpecification)
getColumnReferencesback to summary
public Set<String> getColumnReferences()
isFunctionNameback to summary
protected boolean isFunctionName(AST ast)

Overrides org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.isFunctionName.

Doc from org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.isFunctionName.

A check to see if the text of the given node represents a known function name.

Parameters
ast:AST

The node whose text we want to check.

Returns:boolean

True if the node's text is a known function name, false otherwise.

Annotations
@Override
@SuppressWarnings:SimplifiableIfStatement
isValidIdentifierCharacterback to summary
private static boolean isValidIdentifierCharacter(char c)
makeColumnReferenceback to summary
private String makeColumnReference(String text)
postProcessSortSpecificationback to summary
protected AST postProcessSortSpecification(AST sortSpec)

Overrides org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.postProcessSortSpecification.

Doc from org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.postProcessSortSpecification.

Allow post processing of each sort specification

Parameters
sortSpec:AST

The grammar-built sort specification subtree.

Returns:AST

The processed sort specification subtree.

Annotations
@Override
processSqlValueReferenceback to summary
private AST processSqlValueReference(SqlValueReference sqlValueReference)
quotedIdentifierback to summary
protected AST quotedIdentifier(AST ident)

Overrides org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.quotedIdentifier.

Doc from org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.quotedIdentifier.

Process the given node as a quote identifier. These need to be quoted in the dialect-specific way.

Parameters
ident:AST

The quoted-identifier node.

Returns:AST

The processed node.

Annotations
@Override
quotedStringback to summary
protected AST quotedString(AST ident)

Overrides org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.quotedString.

Doc from org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.quotedString.

Process the given node as a quote string.

Parameters
ident:AST

The quoted string. This is used from within function param recognition, and represents a SQL-quoted string.

Returns:AST

The processed node.

Annotations
@Override
resolveFunctionback to summary
protected AST resolveFunction(AST ast)

Overrides org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.resolveFunction.

Doc from org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.resolveFunction.

Process the given node as a function.

Parameters
ast:AST

The node representing the function invocation (including parameters as subtree components).

Returns:AST

The processed node.

Annotations
@SuppressWarnings:unchecked
@Override
resolveFunctionArgumentback to summary
private String resolveFunctionArgument(AST argumentNode)
resolveIdentback to summary
protected AST resolveIdent(AST ident)

Overrides org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.resolveIdent.

Doc from org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.resolveIdent.

Process the given node as an IDENT. May represent either a column reference or a property reference.

Parameters
ident:AST

The node whose text represents either a column or property reference.

Returns:AST

The processed node.

Annotations
@Override
traceback to summary
protected void trace(String msg)

Overrides org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.trace.

Doc from org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.trace.

Method for logging execution trace information.

Parameters
msg:String

The trace message.

Annotations
@Override
traceInback to summary
public void traceIn(String ruleName)

Overrides antlr.LLkParser.traceIn.

Annotations
@Override
traceOutback to summary
public void traceOut(String ruleName)

Overrides antlr.LLkParser.traceOut.

Annotations
@Override