Class PlannerBindings

    • Method Detail

      • containsKey

        public boolean containsKey​(@Nonnull
                                   ExpressionMatcher<? extends Bindable> key)
        Checks whether there is a bindable bound to key.
        Parameters:
        key - a matcher
        Returns:
        whether there is an object bound to key
      • get

        @Nonnull
        public <T extends Bindable> T get​(@Nonnull
                                          ExpressionMatcher<T> key)
        Retrieve the single bindable bound to key. This method is meant to be a convenient shortcut for the case where the developer is certain that precisely one bindable could be bound to this key. If no bindable is bound to this key, or if there are multiple Bindables bound to this key, this throws a NoSuchElementException.
        Type Parameters:
        T - the type of Bindable that was bound to key
        Parameters:
        key - a matcher
        Returns:
        the bindable object bound to key
        Throws:
        NoSuchElementException - if the number of bindables bound to this key is not exactly one
      • getAll

        @Nonnull
        public <T extends BindableList<T> getAll​(@Nonnull
                                                   ExpressionMatcher<T> key)
        Retrieve all Bindables bound to key if there is at least one such bindable. The bindables in the returned list appear in same order as they appear in the list of children of the RelationalExpression that produced this set of bindings. If no bindable is bound to this key, throw a NoSuchElementException.
        Type Parameters:
        T - the type of Bindable that was bound to key
        Parameters:
        key - a matcher
        Returns:
        a list of bindable objects bound to the key
      • mergedWith

        @Nonnull
        public PlannerBindings mergedWith​(@Nonnull
                                          PlannerBindings other)
        Combine this set of bindings with the given set of bindings. If both sets of bindings contain a binding with the same key, the resulting set of bindings will contain the concatenation of the bindables from this set of bindings and the bindables from the given set of bindings, in that order, providing a predictable ordering of bindings for planner rules that might need it.
        Parameters:
        other - a set of bindings, which may share keys with this set of bindings
        Returns:
        a new set of bindings that contains the bindings from both both sets of bindings
      • asMultiMap

        @Nonnull
        public com.google.common.collect.ImmutableListMultimap<ExpressionMatcher<? extends Bindable>,​Bindable> asMultiMap()
        Return the bindings as multimap for callers that need reason about all bindings in a generic manner, e.g. this can be used by implementations of Debugger to show the contents of all bindings without the knowledge of the existence of particular matchers.
        Returns:
        the backing immutable multi map
      • from

        @Nonnull
        public static PlannerBindings from​(@Nonnull
                                           ExpressionMatcher<? extends Bindable> key,
                                           @Nonnull
                                           Bindable bindable)
        Build a new set of bindings containing a single binding from the given key to the given bindable.
        Parameters:
        key - an expression matcher
        bindable - a bindable object
        Returns:
        a new set of bindings containing a single binding from key to bindable
      • empty

        @Nonnull
        public static PlannerBindings empty()
        Return an empty set of bindings.
        Returns:
        an empty set of bindings