Package org.springframework.expression.spel.support

# Class SimpleEvaluationContext.Builder

java.lang.Object
org.springframework.expression.spel.support.SimpleEvaluationContext.Builder

Enclosing class:
  SimpleEvaluationContext

public static final class SimpleEvaluationContext.Builder extends Object
Builder for `SimpleEvaluationContext`.

## Method Summary

Modifier and Type
Method
Description
`SimpleEvaluationContext`
`build()`
`SimpleEvaluationContext.Builder`
`withAssignmentDisabled()`
Disable assignment within expressions evaluated by this evaluation context.
`SimpleEvaluationContext.Builder`
`withConversionService(org.springframework.core.convert.ConversionService conversionService)`
Register a custom `ConversionService`.
`SimpleEvaluationContext.Builder`
`withIndexAccessors(IndexAccessor... indexAccessors)`
Register the specified `IndexAccessor` delegates.
`SimpleEvaluationContext.Builder`
`withInstanceMethods()`
Register a `DataBindingMethodResolver` for instance method invocation purposes (i.e.
`SimpleEvaluationContext.Builder`
`withMethodResolvers(MethodResolver... resolvers)`
Register the specified `MethodResolver` delegates for a combination of property access and method resolution.
`SimpleEvaluationContext.Builder`
`withRootObject(Object rootObject)`
Specify a default root object to resolve against.
`SimpleEvaluationContext.Builder`
`withTypeConverter(TypeConverter converter)`
Register a custom `TypeConverter`.
`SimpleEvaluationContext.Builder`
`withTypedRootObject(Object rootObject, org.springframework.core.convert.TypeDescriptor typeDescriptor)`
Specify a typed root object to resolve against.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### withAssignmentDisabled

public SimpleEvaluationContext.Builder withAssignmentDisabled()
Disable assignment within expressions evaluated by this evaluation context.

Since:
  5.3.38
See Also:
  - `SimpleEvaluationContext.isAssignmentEnabled()`

### withIndexAccessors

public SimpleEvaluationContext.Builder withIndexAccessors(IndexAccessor... indexAccessors)
Register the specified `IndexAccessor` delegates.

Parameters:
  `indexAccessors` - the index accessors to use
Since:
  6.2

### withMethodResolvers

public SimpleEvaluationContext.Builder withMethodResolvers(MethodResolver... resolvers)
Register the specified `MethodResolver` delegates for a combination of property access and method resolution.

Parameters:
  `resolvers` - the resolver delegates to use
See Also:
  - `withInstanceMethods()`
  - `SimpleEvaluationContext.forPropertyAccessors(org.springframework.expression.PropertyAccessor...)`

### withInstanceMethods

public SimpleEvaluationContext.Builder withInstanceMethods()
Register a `DataBindingMethodResolver` for instance method invocation purposes (i.e. not supporting static methods) in addition to the specified property accessors, typically in combination with a `DataBindingPropertyAccessor`.

See Also:
  - `withMethodResolvers(org.springframework.expression.MethodResolver...)`
  - `SimpleEvaluationContext.forReadOnlyDataBinding()`
  - `SimpleEvaluationContext.forReadWriteDataBinding()`

### withConversionService

public SimpleEvaluationContext.Builder withConversionService(org.springframework.core.convert.ConversionService conversionService)
Register a custom `ConversionService`.

By default a `StandardTypeConverter` backed by a `DefaultConversionService` is used.

See Also:
  - `withTypeConverter(org.springframework.expression.TypeConverter)`
  - `StandardTypeConverter(ConversionService)`

### withTypeConverter

public SimpleEvaluationContext.Builder withTypeConverter(TypeConverter converter)
Register a custom `TypeConverter`.

By default a `StandardTypeConverter` backed by a `DefaultConversionService` is used.

See Also:
  - `withConversionService(org.springframework.core.convert.ConversionService)`
  - `StandardTypeConverter()`

### withRootObject

public SimpleEvaluationContext.Builder withRootObject(Object rootObject)
Specify a default root object to resolve against.

Default is none, expecting an object argument at evaluation time.

See Also:
  - `Expression.getValue(EvaluationContext)`
  - `Expression.getValue(EvaluationContext, Object)`

### withTypedRootObject

public SimpleEvaluationContext.Builder withTypedRootObject(Object rootObject, org.springframework.core.convert.TypeDescriptor typeDescriptor)
Specify a typed root object to resolve against.

Default is none, expecting an object argument at evaluation time.

See Also:
  - `Expression.getValue(EvaluationContext)`
  - `Expression.getValue(EvaluationContext, Object)`

### build

public SimpleEvaluationContext build()