Class EvaluationContext

java.lang.Object
com.apple.foundationdb.record.EvaluationContext

@API(UNSTABLE) public class EvaluationContext extends Object
A context for query evaluation.

The primary state of an evaluation context is a set of parameter Bindings.

See Also:
  • Field Details

  • Method Details

    • empty

      public static EvaluationContext empty()
      Get an empty evaluation context.
      Returns:
      an evaluation context with no bindings
    • forBindings

      @Nonnull public static EvaluationContext forBindings(@Nonnull Bindings bindings)
      Create a new EvaluationContext around a given set of Bindings from parameter names to values.
      Parameters:
      bindings - a mapping from parameter name to values
      Returns:
      a new evaluation context with the bindings
    • forBindingsAndTypeRepository

      @Nonnull public static EvaluationContext forBindingsAndTypeRepository(@Nonnull Bindings bindings, @Nonnull TypeRepository typeRepository)
      Create a new EvaluationContext around a given set of Bindings and a TypeRepository. from parameter names to values.
      Parameters:
      bindings - a mapping from parameter name to values
      typeRepository - a type repository
      Returns:
      a new evaluation context with the bindings and the schema.
    • forTypeRepository

      @Nonnull public static EvaluationContext forTypeRepository(@Nonnull TypeRepository typeRepository)
    • forBinding

      @Nonnull public static EvaluationContext forBinding(@Nonnull String bindingName, @Nullable Object value)
      Create a new EvaluationContext with a single binding.
      Parameters:
      bindingName - the binding name to add
      value - the value to bind the name to
      Returns:
      a new EvaluationContext with the new binding
    • getBindings

      @Nonnull public Bindings getBindings()
      Retrieve the mapping from parameter names to values associated with this context.
      Returns:
      a mapping from parameter names to to values
    • getBinding

      @Nullable public Object getBinding(@Nonnull String name)
      Get the value bound to a single parameter.
      Parameters:
      name - the name of the parameter to retrieve the binding of
      Returns:
      the value bound to the given parameter
      See Also:
    • getBinding

      public Object getBinding(@Nonnull Bindings.Internal type, @Nonnull CorrelationIdentifier alias)
      Get the value bound to a single parameter.
      Parameters:
      type - the type of the parameter
      alias - the correlation identifier
      Returns:
      the value bound to the given parameter
    • dereferenceConstant

      @Nullable public Object dereferenceConstant(@Nonnull CorrelationIdentifier alias, @Nonnull String constantId)
      Dereferences the constant.
      Parameters:
      alias - the correlation identifier
      constantId - the constant id
      Returns:
      de-referenced constant
    • getTypeRepository

      @Nonnull public TypeRepository getTypeRepository()
    • childBuilder

      @Nonnull public EvaluationContextBuilder childBuilder()
      Construct a builder from this context. This allows the user to create a new EvaluationContext that has all of the same data as the current context except for a few modifications expressed as mutations made to the builder.
      Returns:
      a builder for this class based on this instance
    • newBuilder

      @Nonnull public static EvaluationContextBuilder newBuilder()
      Construct a new builder from this context.
      Returns:
      a builder for this class based on this instance
    • withBinding

      @Nonnull public EvaluationContext withBinding(@Nonnull String bindingName, @Nullable Object value)
      Create a new EvaluationContext with an additional binding. The returned context will have all of the same state as the current context included all bindings except that it will bind an additional parameter to an additional value.
      Parameters:
      bindingName - the binding name to add
      value - the value to bind the name to
      Returns:
      a new EvaluationContext with the new binding
    • withBinding

      public EvaluationContext withBinding(Bindings.Internal type, @Nonnull CorrelationIdentifier alias, @Nullable Object value)
      Create a new EvaluationContext with an additional binding. The returned context will have all of the same state as the current context included all bindings except that it will bind an additional parameter to an additional value.
      Parameters:
      type - the type of the binding.
      alias - the alias determining the binding name to add
      value - the value to bind the name to
      Returns:
      a new EvaluationContext with the new binding