Package com.apple.foundationdb.record
Class EvaluationContext
- java.lang.Object
-
- com.apple.foundationdb.record.EvaluationContext
-
@API(MAINTAINED) 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:
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 Modifier and Type Field Description static EvaluationContext
EMPTY
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EvaluationContextBuilder
childBuilder()
Construct a builder from this context.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.Object
getBinding(String name)
Get the value bound to a single parameter.Bindings
getBindings()
Retrieve the mapping from parameter names to values associated with this context.static EvaluationContextBuilder
newBuilder()
Construct a new builder from this context.EvaluationContext
withBinding(String bindingName, Object value)
Create a newEvaluationContext
with an additional binding.
-
-
-
Field Detail
-
EMPTY
public static final EvaluationContext EMPTY
-
-
Method Detail
-
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 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
-
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
@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:
Bindings.get(String)
-
childBuilder
@Nonnull public EvaluationContextBuilder 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
@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 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
-
-