Interface ExpressionRef<T extends RelationalExpression>

    • Method Detail

      • insert

        boolean insert​(@Nonnull
                       T newValue)
        Insert a new expression into this reference.
        Parameters:
        newValue - the value to be inserted
        Returns:
        true if the value was not already part of the reference and was inserted, false if the given value was already contained in the reference and was therefore not inserted.
      • get

        @Nonnull
        T get()
        Return the expression contained in this reference. If the reference does not support getting its expresssion (for example, because it holds more than one expression, or none at all), this should throw an exception.
        Returns:
        the expression contained in this reference
        Throws:
        ExpressionRef.UngettableReferenceException - if the reference does not support retrieving its expression
      • bindTo

        @Nonnull
        default Stream<PlannerBindings> bindTo​(@Nonnull
                                               ExpressionMatcher<? extends Bindable> matcher)
        Try to bind the given matcher to this reference. It should not try to match to the members of the reference; if the given matcher needs to match to a RelationalExpression rather than an ExpressionRef, it will call bindWithin(ExpressionMatcher) instead.

        Binding to references can be a bit subtle: some matchers (such as ReferenceMatcher) can bind to references directly while others (such as TypeMatcher) can't, since they need access to the underlying operator which might not even be well defined. This method implements binding to the reference, rather than to its member(s).

        Specified by:
        bindTo in interface Bindable
        Parameters:
        matcher - a matcher to match with
        Returns:
        a stream of bindings if the match succeeded or an empty stream if it failed
      • bindWithin

        @Nonnull
        Stream<PlannerBindings> bindWithin​(@Nonnull
                                           ExpressionMatcher<? extends Bindable> matcher)
        Try to bind the given matcher to the members of this reference. If this reference has more than one member, it should try to match to any of them and produce a stream of bindings covering all possible combinations. If possible, this should be done in a lazy fashion using the Stream API, so as to minimize unnecessary work.
        Parameters:
        matcher - an expression matcher to match the member(s) of this reference with
        Returns:
        a stream of bindings if the match succeeded or an empty stream if it failed