public class SpELTransformer extends Object implements FunctionTransformer, org.springframework.context.ApplicationContextAware
context. If the input is null it defaults to the context and visa-versa
expressionTest() is testExpression is true and additionally caches expressionInstance for recurring evaluation as the expression or configuration is unlikely to change.
If you do not want it cached and re-construct the expression from configuration on each call then set cacheExpression to false.
ignoreInput is false, then the input is considered as the context to which the SpEL properties are resolved. Example: Map.
See Expression.getValue(Object). One can refer to root as #root and this as #this. In the bean def. these result in BeanExpressionContext objects.
<!-- Auto Index & cache clear -->
getBean("contentFacetSearch").index()
getBean("cacheManager").getCache("#{T(com.neurosys.lookups.CacheLookups).CONTENT_PUBLISH_CACHE_NAME}").clear()
TODO: Add unit test case| Constructor and Description |
|---|
SpELTransformer() |
SpELTransformer(String expression) |
| Modifier and Type | Method and Description |
|---|---|
protected org.springframework.expression.Expression |
deriveExpression() |
org.springframework.expression.spel.SpelParserConfiguration |
getConfiguration() |
org.springframework.expression.spel.support.StandardEvaluationContext |
getContext()
Default context supplied to the
ExpressionParser |
String |
getExpression()
The expression to parse against
|
Class |
getReturnType()
The expected return type of the expression
|
boolean |
isCacheExpression()
If true will use
expressionInstanceto cache the Expression for frequent use. |
boolean |
isIgnoreInput()
If true it will only consider
context as input to the Expression parser |
boolean |
isTestExpression()
If true will self test expression on startup.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setCacheExpression(boolean cacheExpression)
If true will use
expressionInstanceto cache the Expression for frequent use. |
void |
setConfiguration(org.springframework.expression.spel.SpelParserConfiguration configuration) |
void |
setContext(org.springframework.expression.spel.support.StandardEvaluationContext context)
Default context supplied to the
ExpressionParser |
void |
setExpression(String expression)
The expression to parse against
|
void |
setIgnoreInput(boolean ignoreInput)
If true it will only consider
context as input to the Expression parser |
void |
setReturnType(Class returnType)
The expected return type of the expression
|
void |
setTestExpression(boolean testExpression)
If true will self test expression on startup.
|
Object |
transform(Object input) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplypublic SpELTransformer()
public SpELTransformer(String expression)
protected org.springframework.expression.Expression deriveExpression()
public Object transform(Object input)
transform in interface org.apache.commons.collections.Transformerpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic org.springframework.expression.spel.support.StandardEvaluationContext getContext()
ExpressionParserpublic void setContext(org.springframework.expression.spel.support.StandardEvaluationContext context)
ExpressionParserpublic Class getReturnType()
public void setReturnType(Class returnType)
public org.springframework.expression.spel.SpelParserConfiguration getConfiguration()
public void setConfiguration(org.springframework.expression.spel.SpelParserConfiguration configuration)
public String getExpression()
public void setExpression(String expression)
public boolean isIgnoreInput()
context as input to the Expression parserpublic void setIgnoreInput(boolean ignoreInput)
context as input to the Expression parserpublic boolean isTestExpression()
public void setTestExpression(boolean testExpression)
public boolean isCacheExpression()
expressionInstanceto cache the Expression for frequent use.public void setCacheExpression(boolean cacheExpression)
expressionInstanceto cache the Expression for frequent use.Copyright © 2018. All rights reserved.