- 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
-
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 aCondition
expression.Field<?>
parseField(ParseContext ctx)
Attempt to parse aField
expression.Table<?>
parseTable(ParseContext ctx)
Attempt to parse aTable
expression.
-
Constructor Details
-
CallbackParseListener
public CallbackParseListener()
-
-
Method Details
-
parseField
Description copied from interface:ParseListener
Attempt to parse aField
expression.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 ofA
andB
. Client code does not have to (and should not) handle the+
operator, or its precedence.- Specified by:
parseField
in interfaceParseListener
- Returns:
- The
Field
expression if a field could be parsed, ornull
otherwise. - Throws:
ParserException
- Any syntax error or other exception that may have occurred while attempting to parse aField
expression.
-
parseTable
Description copied from interface:ParseListener
Attempt to parse aTable
expression.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 ofA
andB
. Client code does not have to (and should not) handle thejoin
operator, or its precedence.- Specified by:
parseTable
in interfaceParseListener
- Returns:
- The
Table
expression if a table could be parsed, ornull
otherwise. - Throws:
ParserException
- Any syntax error or other exception that may have occurred while attempting to parse aTable
expression.
-
parseCondition
Description copied from interface:ParseListener
Attempt to parse aCondition
expression.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 ofA
andB
. Client code does not have to (and should not) handle theor
operator, or its precedence.- Specified by:
parseCondition
in interfaceParseListener
- Returns:
- The
Condition
expression if a condition could be parsed, ornull
otherwise. - Throws:
ParserException
- Any syntax error or other exception that may have occurred while attempting to parse aCondition
expression.
-
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)
-