- All Implemented Interfaces:
EventListener,ParseListener
ParseListener that allows for functional composition.
For example:
ParseListener listener = ParseListener
.onParseField(ctx -> something())
.onParseCondition(ctx -> something());
- Author:
- Lukas Eder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiononParseCondition(Function<? super ParseContext,? extends Condition> newOnParseCondition)onParseField(Function<? super ParseContext,? extends Field<?>> newOnParseField)onParseTable(Function<? super ParseContext,? extends Table<?>> newOnParseTable)parseCondition(ParseContext ctx)Attempt to parse aConditionexpression.Field<?>parseField(ParseContext ctx)Attempt to parse aFieldexpression.Table<?>parseTable(ParseContext ctx)Attempt to parse aTableexpression.
-
Constructor Details
-
CallbackParseListener
public CallbackParseListener()
-
-
Method Details
-
parseField
Description copied from interface:ParseListenerAttempt to parse aFieldexpression.This parses a "term", meaning the callback does not interfere with any operators or operator precedence, but will be called only when a field term can appear. For example, with input SQL like
A + B, the callback is called at the positions ofAandB. Client code does not have to (and should not) handle the+operator, or its precedence.- Specified by:
parseFieldin interfaceParseListener- Returns:
- The
Fieldexpression if a field could be parsed, ornullotherwise. - Throws:
ParserException- Any syntax error or other exception that may have occurred while attempting to parse aFieldexpression.
-
parseTable
Description copied from interface:ParseListenerAttempt to parse aTableexpression.This parses a "table factor", meaning the callback does not interfere with any operators or operator precedence, but will be called only when a condition term can appear. For example, with input SQL like
A join B, the callback is called at the positions ofAandB. Client code does not have to (and should not) handle thejoinoperator, or its precedence.- Specified by:
parseTablein interfaceParseListener- Returns:
- The
Tableexpression if a table could be parsed, ornullotherwise. - Throws:
ParserException- Any syntax error or other exception that may have occurred while attempting to parse aTableexpression.
-
parseCondition
Description copied from interface:ParseListenerAttempt to parse aConditionexpression.This parses a "predicate", meaning the callback does not interfere with any operators or operator precedence, but will be called only when a condition term can appear. For example, with input SQL like
A or B, the callback is called at the positions ofAandB. Client code does not have to (and should not) handle theoroperator, or its precedence.- Specified by:
parseConditionin interfaceParseListener- Returns:
- The
Conditionexpression if a condition could be parsed, ornullotherwise. - Throws:
ParserException- Any syntax error or other exception that may have occurred while attempting to parse aConditionexpression.
-
onParseField
public final CallbackParseListener onParseField(Function<? super ParseContext,? extends Field<?>> newOnParseField) -
onParseTable
public final CallbackParseListener onParseTable(Function<? super ParseContext,? extends Table<?>> newOnParseTable) -
onParseCondition
public final CallbackParseListener onParseCondition(Function<? super ParseContext,? extends Condition> newOnParseCondition)
-