Package com.apple.foundationdb.record
Class EvaluationContextBuilder
java.lang.Object
com.apple.foundationdb.record.EvaluationContextBuilder
A builder for
EvaluationContext.
context.childBuilder().setBinding("x", x).build()
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreate an empty builder.protectedEvaluationContextBuilder(EvaluationContext original) Create a builder based on an existingEvaluationContext. -
Method Summary
Modifier and TypeMethodDescriptionbuild(TypeRepository typeRepository) Construct anEvaluationContextwith updated bindings.getBinding(String name) Get the current binding for some parameter in the currentBindings.setBinding(CorrelationIdentifier alias, Object value) Bind an alias to a value.setBinding(String name, Object value) Bind a name to a value.setConstant(CorrelationIdentifier alias, Object value)
-
Field Details
-
bindings
-
-
Constructor Details
-
EvaluationContextBuilder
protected EvaluationContextBuilder()Create an empty builder. -
EvaluationContextBuilder
Create a builder based on an existingEvaluationContext. This ensures that the resultingEvaluationContexthas all of the bindings contained in the original context (except for those which have had their value over-ridden).- Parameters:
original- the originalEvaluationContextto build a new one around
-
-
Method Details
-
getBinding
Get the current binding for some parameter in the currentBindings. This will reflect any mutations that have been made to the state through calls tosetBinding(String, Object)since the builder was created.- Parameters:
name- the name of the parameter to retrieve the binding of- Returns:
- the current value bound to the given parameter
- See Also:
-
setBinding
Bind a name to a value. This mutation will be reflected in theEvaluationContextreturned by callingbuild(TypeRepository).- Parameters:
name- the name of the bindingvalue- the value to associate with the name- Returns:
- this
EvaluationContextBuilder
-
setBinding
public EvaluationContextBuilder setBinding(@Nonnull CorrelationIdentifier alias, @Nullable Object value) Bind an alias to a value. This mutation will be reflected in theEvaluationContextreturned by callingbuild(TypeRepository).- Parameters:
alias- the alias of the bindingvalue- the value to associate with the name- Returns:
- this
EvaluationContextBuilder
-
setConstant
public EvaluationContextBuilder setConstant(@Nonnull CorrelationIdentifier alias, @Nullable Object value) -
build
Construct anEvaluationContextwith updated bindings. This should include all bindings specified though the originalEvaluationContextincluded in this object's constructor as well as any bindings that have been added through calls tosetBinding(String, Object). All other state included in the context should remain the same.- Parameters:
typeRepository- a type repository to be used in the new context- Returns:
- an
EvaluationContextwith updated bindings
-