@API(value=EXPERIMENTAL) public interface PlannerRuleCall
PlannerRuleCall
is a context object that supports a single application of a rule to a particular
expression. It stores and provides convenient access to various context related to the transformation, such as any
bindings, access to the PlanContext
, etc. A PlannerRuleCall
is passed to every rule's
PlannerRule.onMatch(PlannerRuleCall)
method.
Additionally, the rule call implementation is responsible for registering any new expressions generated by the rule
via the yield(ExpressionRef)
method. This registration process includes updating any planner data
structures to include the new expression. In general, each planner will have an associated implementation of
PlannerRuleCall
.Modifier and Type | Method and Description |
---|---|
default <U extends Bindable> |
get(ExpressionMatcher<U> key)
Return the bindable that is bound to the given key.
|
PlannerBindings |
getBindings()
Return the map of bindings that this rule's matcher expression produced, which includes (by contract) all of the
bindings specified by the rule associated with this call.
|
PlanContext |
getContext()
Get the planning context with metadata that might be relevant to the planner, such as the list of available
indexes.
|
<U extends PlannerExpression> |
ref(U expression)
Wrap the given planner expression in an implementation of
ExpressionRef suitable for the planner associated
with this rule. |
void |
yield(ExpressionRef<? extends PlannerExpression> expression)
Notify the planner's data structures that the new expression contained in
expression has been
produced by the rule. |
@Nonnull PlannerBindings getBindings()
get(ExpressionMatcher)
.@Nonnull PlanContext getContext()
PlanContext
object with various metadata that could affect planning@Nonnull default <U extends Bindable> U get(@Nonnull ExpressionMatcher<U> key)
U
- the requested return typekey
- the binding from the rule's matcher expressionname
in the rule's matcher expressionNoSuchElementException
- when key
is not a valid binding, or is not bound to a bindablevoid yield(@Nonnull ExpressionRef<? extends PlannerExpression> expression)
expression
has been
produced by the rule. This method may be called zero or more times by the rule's onMatch()
method.expression
- the expression produced by the rule<U extends PlannerExpression> ExpressionRef<U> ref(U expression)
ExpressionRef
suitable for the planner associated
with this rule. Different rule call implementations might use different reference types depending on the specifics
of the associated planner.U
- the type of the planner expressionexpression
- the planner expression to wrap in a reference typeexpression
wrapped in a reference