Class CachingStdEvaluationContextFactory
- java.lang.Object
-
- com.broadleafcommerce.rulesengine.expression.context.factory.CachingStdEvaluationContextFactory
-
- All Implemented Interfaces:
EvaluationContextFactory
public class CachingStdEvaluationContextFactory extends Object implements EvaluationContextFactory
Default implementation of
EvaluationContextFactorythat caches theEvaluationContexts it creates. By default, the key is generated from the root object and theExpressionContext. The factory uses aSupplierwith the generic typeStandardEvaluationContextto generate new contexts.The
EvaluationContextscreated by this factory support SpEL expressions evaluations on concrete objects orMaps.- Author:
- Nathan Moore (nathanmoore).
- See Also:
- SPeL
documentation,
MapAccessor,MapAccessor
-
-
Field Summary
Fields Modifier and Type Field Description protected static Map<Serializable,org.springframework.expression.EvaluationContext>CONTEXT_CACHEprotected Map<String,Object>defaultExpressionVariablesprotected List<org.springframework.expression.PropertyAccessor>defaultPropertyAccessorsprotected Supplier<org.springframework.expression.spel.support.StandardEvaluationContext>evaluationContextSupplier
-
Constructor Summary
Constructors Constructor Description CachingStdEvaluationContextFactory(List<org.springframework.expression.PropertyAccessor> blDefaultPropertyAccessors, Map<String,Object> blDefaultExpressionVariables, Supplier<org.springframework.expression.spel.support.StandardEvaluationContext> blEvaluationContextSupplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.springframework.expression.EvaluationContextbuildEvaluationContext(Object rootObject, ExpressionContext expressionContext)org.springframework.expression.EvaluationContextgetEvaluationContext(Object rootObject, ExpressionContext expressionContext)Gets anEvaluationContext.
-
-
-
Field Detail
-
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
protected final List<org.springframework.expression.PropertyAccessor> defaultPropertyAccessors
-
-
Constructor Detail
-
CachingStdEvaluationContextFactory
public CachingStdEvaluationContextFactory(List<org.springframework.expression.PropertyAccessor> blDefaultPropertyAccessors, Map<String,Object> blDefaultExpressionVariables, Supplier<org.springframework.expression.spel.support.StandardEvaluationContext> blEvaluationContextSupplier)
-
-
Method Detail
-
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)
-
-