Module spring.data.commons
Class CachingValueExpressionEvaluatorFactory
java.lang.Object
org.springframework.data.mapping.model.CachingValueExpressionEvaluatorFactory
- All Implemented Interfaces:
ValueEvaluationContextProvider
public class CachingValueExpressionEvaluatorFactory
extends Object
implements ValueEvaluationContextProvider
Factory to create a ValueExpressionEvaluator
- Since:
- 3.3
- Author:
- Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionCachingValueExpressionEvaluatorFactory(ExpressionParser expressionParser, EnvironmentCapable environmentProvider, EvaluationContextProvider evaluationContextProvider) Creates a newCachingValueExpressionEvaluatorFactoryfor the givenExpressionParser,Environment providerandEvaluationContextProviderwith a cache size of 256.CachingValueExpressionEvaluatorFactory(ExpressionParser expressionParser, EnvironmentCapable environmentProvider, EvaluationContextProvider evaluationContextProvider, int cacheSize) Creates a newCachingValueExpressionEvaluatorFactoryfor the givenExpressionParser,Environment providerandEvaluationContextProviderwith a specificcacheSize. -
Method Summary
Modifier and TypeMethodDescriptionCreates a newValueExpressionEvaluatorusing the givensourceas root object.getEvaluationContext(Object rootObject) Return aEvaluationContextbuilt using the given parameter values.getEvaluationContext(Object rootObject, ExpressionDependencies dependencies) Return a tailoredEvaluationContextbuilt using the given parameter values and consideringexpression dependencies.
-
Constructor Details
-
CachingValueExpressionEvaluatorFactory
public CachingValueExpressionEvaluatorFactory(ExpressionParser expressionParser, EnvironmentCapable environmentProvider, EvaluationContextProvider evaluationContextProvider) Creates a newCachingValueExpressionEvaluatorFactoryfor the givenExpressionParser,Environment providerandEvaluationContextProviderwith a cache size of 256.- Parameters:
expressionParser-environmentProvider-evaluationContextProvider-
-
CachingValueExpressionEvaluatorFactory
public CachingValueExpressionEvaluatorFactory(ExpressionParser expressionParser, EnvironmentCapable environmentProvider, EvaluationContextProvider evaluationContextProvider, int cacheSize) Creates a newCachingValueExpressionEvaluatorFactoryfor the givenExpressionParser,Environment providerandEvaluationContextProviderwith a specificcacheSize.- Parameters:
expressionParser-environmentProvider-evaluationContextProvider-cacheSize-
-
-
Method Details
-
getEvaluationContext
Description copied from interface:ValueEvaluationContextProviderReturn aEvaluationContextbuilt using the given parameter values.- Specified by:
getEvaluationContextin interfaceValueEvaluationContextProvider- Parameters:
rootObject- the root object to set in theEvaluationContext.- Returns:
-
getEvaluationContext
public ValueEvaluationContext getEvaluationContext(@Nullable Object rootObject, ExpressionDependencies dependencies) Description copied from interface:ValueEvaluationContextProviderReturn a tailoredEvaluationContextbuilt using the given parameter values and consideringexpression dependencies. The returnedEvaluationContextmay contain a reduced visibility of methods and properties/fields according to the requiredexpression dependencies.- Specified by:
getEvaluationContextin interfaceValueEvaluationContextProvider- Parameters:
rootObject- the root object to set in theEvaluationContext.dependencies- the requested expression dependencies to be available.- Returns:
-
create
Creates a newValueExpressionEvaluatorusing the givensourceas root object.- Parameters:
source- the root object for evaluating the expression.- Returns:
- a new
ValueExpressionEvaluatorto evaluate the expression in the context of the givensourceobject.
-