@API(value=MAINTAINED) public class EvaluationContextBuilder extends Object
EvaluationContext
.
context.childBuilder().setBinding("x", x).build()
Modifier and Type | Field and Description |
---|---|
protected Bindings.Builder |
bindings |
Modifier | Constructor and Description |
---|---|
protected |
EvaluationContextBuilder()
Create an empty builder.
|
protected |
EvaluationContextBuilder(EvaluationContext original)
Create a builder based on an existing
EvaluationContext . |
Modifier and Type | Method and Description |
---|---|
EvaluationContext |
build()
Construct an
EvaluationContext with updated bindings. |
Object |
getBinding(String name)
Get the current binding for some parameter in the current
Bindings . |
EvaluationContextBuilder |
setBinding(String name,
Object value)
Bind one name to a value.
|
@Nonnull protected final Bindings.Builder bindings
protected EvaluationContextBuilder()
protected EvaluationContextBuilder(@Nonnull EvaluationContext original)
EvaluationContext
.
This ensures that the resulting EvaluationContext
has all of the bindings contained in the original context (except
for those which have had their value over-ridden).original
- the original EvaluationContext
to build a new one around@Nullable public Object getBinding(@Nonnull String name)
Bindings
.
This will reflect any mutations that have been made to the state
through calls to setBinding(String, Object)
since the
builder was created.name
- the name of the parameter to retrieve the binding ofEvaluationContext.getBinding(String)
@Nonnull public EvaluationContextBuilder setBinding(@Nonnull String name, @Nullable Object value)
EvaluationContext
returned by
calling build()
.name
- the name of the bindingvalue
- the value to associate with the nameEvaluationContextBuilder
@Nonnull public EvaluationContext build()
EvaluationContext
with updated bindings.
This should include all bindings specified though the original
EvaluationContext
included in this object's constructor
as well as any bindings that have been added through calls to
setBinding(String, Object)
. All other state included
in the context should remain the same.EvaluationContext
with updated bindings