Package com.apple.foundationdb.record
Class EvaluationContext
java.lang.Object
com.apple.foundationdb.record.EvaluationContext
A context for query evaluation.
The primary state of an evaluation context is a set of parameter Bindings
.
- See Also:
-
QueryComponent.eval(com.apple.foundationdb.record.provider.foundationdb.FDBRecordStoreBase<M>, com.apple.foundationdb.record.EvaluationContext, com.apple.foundationdb.record.provider.foundationdb.FDBRecord<M>)
RecordQueryPlan.execute(com.apple.foundationdb.record.provider.foundationdb.FDBRecordStoreBase<M>, com.apple.foundationdb.record.EvaluationContext, byte[], com.apple.foundationdb.record.ExecuteProperties)
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionConstruct a builder from this context.dereferenceConstant
(CorrelationIdentifier alias, String constantId) Dereferences the constant.static EvaluationContext
empty()
Get an empty evaluation context.static EvaluationContext
forBinding
(String bindingName, Object value) Create a newEvaluationContext
with a single binding.static EvaluationContext
forBindings
(Bindings bindings) Create a newEvaluationContext
around a given set ofBindings
from parameter names to values.static EvaluationContext
forBindingsAndTypeRepository
(Bindings bindings, TypeRepository typeRepository) static EvaluationContext
forTypeRepository
(TypeRepository typeRepository) getBinding
(Bindings.Internal type, CorrelationIdentifier alias) Get the value bound to a single parameter.getBinding
(String name) Get the value bound to a single parameter.Retrieve the mapping from parameter names to values associated with this context.static EvaluationContextBuilder
Construct a new builder from this context.withBinding
(Bindings.Internal type, CorrelationIdentifier alias, Object value) Create a newEvaluationContext
with an additional binding.withBinding
(String bindingName, Object value) Create a newEvaluationContext
with an additional binding.
-
Field Details
-
EMPTY
-
-
Method Details
-
empty
Get an empty evaluation context.- Returns:
- an evaluation context with no bindings
-
forBindings
Create a newEvaluationContext
around a given set ofBindings
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 newEvaluationContext
around a given set ofBindings
and aTypeRepository
. from parameter names to values.- Parameters:
bindings
- a mapping from parameter name to valuestypeRepository
- a type repository- Returns:
- a new evaluation context with the bindings and the schema.
-
forTypeRepository
-
forBinding
@Nonnull public static EvaluationContext forBinding(@Nonnull String bindingName, @Nullable Object value) Create a newEvaluationContext
with a single binding.- Parameters:
bindingName
- the binding name to addvalue
- the value to bind the name to- Returns:
- a new
EvaluationContext
with the new binding
-
getBindings
Retrieve the mapping from parameter names to values associated with this context.- Returns:
- a mapping from parameter names to to values
-
getBinding
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
Get the value bound to a single parameter.- Parameters:
type
- the type of the parameteralias
- 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 identifierconstantId
- the constant id- Returns:
- de-referenced constant
-
getTypeRepository
-
childBuilder
Construct a builder from this context. This allows the user to create a newEvaluationContext
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
Construct a new builder from this context.- Returns:
- a builder for this class based on this instance
-
withBinding
Create a newEvaluationContext
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 addvalue
- 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 newEvaluationContext
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 addvalue
- the value to bind the name to- Returns:
- a new
EvaluationContext
with the new binding
-