Class CachingStdEvaluationContextFactory
java.lang.Object
com.broadleafcommerce.rulesengine.expression.context.factory.CachingStdEvaluationContextFactory
- All Implemented Interfaces:
EvaluationContextFactory
Default implementation of EvaluationContextFactory that caches the
EvaluationContexts it creates. By default, the key is generated from the root object and
the ExpressionContext. The factory uses a Supplier with the generic type
StandardEvaluationContext to generate new contexts.
The EvaluationContexts created by this factory support SpEL expressions
evaluations on concrete objects or Maps.
- Author:
- Nathan Moore (nathanmoore).
- See Also:
-
- SPeL documentation
MapAccessorMapAccessor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Map<Serializable,org.springframework.expression.EvaluationContext> protected final List<org.springframework.expression.PropertyAccessor>protected final Supplier<org.springframework.expression.spel.support.StandardEvaluationContext> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.expression.EvaluationContextbuildEvaluationContext(Object rootObject, ExpressionContext expressionContext) org.springframework.expression.EvaluationContextgetEvaluationContext(Object rootObject, ExpressionContext expressionContext) Gets anEvaluationContext.
-
Field Details
-
CONTEXT_CACHE
protected static final Map<Serializable,org.springframework.expression.EvaluationContext> CONTEXT_CACHE -
evaluationContextSupplier
protected final Supplier<org.springframework.expression.spel.support.StandardEvaluationContext> evaluationContextSupplier -
defaultPropertyAccessors
-
defaultExpressionVariables
-
-
Constructor Details
-
CachingStdEvaluationContextFactory
-
-
Method Details
-
getEvaluationContext
public org.springframework.expression.EvaluationContext getEvaluationContext(Object rootObject, ExpressionContext expressionContext) Gets anEvaluationContext.- Specified by:
getEvaluationContextin interfaceEvaluationContextFactory- Parameters:
rootObject- root object to evaluate an expression againstexpressionContext- DTO for data required to evaluate an expression- Returns:
- an
EvaluationContext
-
buildEvaluationContext
protected org.springframework.expression.EvaluationContext buildEvaluationContext(Object rootObject, ExpressionContext expressionContext)
-