|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.krad.uif.service.impl.ExpressionEvaluatorServiceImpl
public class ExpressionEvaluatorServiceImpl
Evaluates expression language statements using the Spring EL engine TODO: Look into using Rice KRMS for evaluation
Constructor Summary | |
---|---|
ExpressionEvaluatorServiceImpl()
|
Method Summary | |
---|---|
protected void |
addCustomFunctions(org.springframework.expression.spel.support.StandardEvaluationContext context)
Registers custom functions for el expressions with the given context |
boolean |
containsElPlaceholder(String value)
Indicates whether or not the given string contains the el placholder (begin and end delimiters) |
Object |
evaluateExpression(Object contextObject,
Map<String,Object> evaluationParameters,
String expressionStr)
Evaluates the given el expression against the content object and parameters, and returns the result of the evaluation |
String |
evaluateExpressionTemplate(Object contextObject,
Map<String,Object> evaluationParameters,
String expressionTemplate)
Evaluates the given expression template string against the context object and map of parameters |
void |
evaluateObjectExpressions(Object object,
Object contextObject,
Map<String,Object> evaluationParameters)
Evaluates any el expressions that are found as a string property value for the object |
protected void |
evaluatePropertyExpressions(Object object,
Object contextObject,
Map<String,Object> evaluationParameters)
Retrieves the Map from the given object that containing the property expressions that should be evaluated. |
protected void |
evaluatePropertyReplacers(Object object,
Object contextObject,
Map<String,Object> evaluationParameters)
Iterates through any configured PropertyReplacer instances for the component and
evaluates the given condition. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExpressionEvaluatorServiceImpl()
Method Detail |
---|
public void evaluateObjectExpressions(Object object, Object contextObject, Map<String,Object> evaluationParameters)
ExpressionEvaluatorService
Using reflection the properties for the object are retrieved and if of
String
type the corresponding value is retrieved. If the
value is not empty and contains the el placeholder see
ExpressionEvaluatorService.containsElPlaceholder(String)
then the expression is evaluated
using the given context object and parameters. The evaluated string is
then set as the new property value, or in the case of a template
(expression contained within a literal string), the expression part is
replaced in the property value.
In addition to evaluating any property expressions, any configured
PropertyReplacer
for the object are also evaluated and if a
match occurs those property replacements are made
evaluateObjectExpressions
in interface ExpressionEvaluatorService
object
- - object whose properties should be checked for expressions
and evaluatedcontextObject
- - context object for the expression evaluationsevaluationParameters
- - map of parameters that may appear in expressions, the map
key gives the parameter name that may appear in the
expression, and the map value is the object that expression
should evaluate against when that name is foundExpressionEvaluatorService.evaluateObjectExpressions(java.lang.Object,
java.lang.Object, java.util.Map)
public String evaluateExpressionTemplate(Object contextObject, Map<String,Object> evaluationParameters, String expressionTemplate)
ExpressionEvaluatorService
If the template string contains one or more el placeholders (see
ExpressionEvaluatorService.containsElPlaceholder(String)
), the expression contained within
the placeholder will be evaluated and the corresponding value will be
substituted back into the property value where the placeholder occurred.
If no placeholders are found, the string will be returned unchanged
evaluateExpressionTemplate
in interface ExpressionEvaluatorService
contextObject
- - context object for the expression evaluationsevaluationParameters
- - map of parameters that may appear in expressions, the map
key gives the parameter name that may appear in the
expression, and the map value is the object that expression
should evaluate against when that name is foundexpressionTemplate
- - string that should be evaluated for el expressions
ExpressionEvaluatorService.evaluateExpressionTemplate(java.lang.Object,
java.util.Map, java.lang.String)
public Object evaluateExpression(Object contextObject, Map<String,Object> evaluationParameters, String expressionStr)
ExpressionEvaluatorService
The given expression string is assumed to be one el expression and should not contain the el placeholders. The returned result depends on the evaluation and what type is returns, for instance a boolean will be return for a boolean expression, or a string for string expression
evaluateExpression
in interface ExpressionEvaluatorService
contextObject
- - context object for the expression evaluationsevaluationParameters
- - map of parameters that may appear in expressions, the map
key gives the parameter name that may appear in the
expression, and the map value is the object that expression
should evaluate against when that name is foundexpressionStr
- - el expression to evaluate
ExpressionEvaluatorService.evaluateExpression(java.lang.Object,
java.util.Map, java.lang.String)
protected void addCustomFunctions(org.springframework.expression.spel.support.StandardEvaluationContext context)
context
- - context instance to register functions toprotected void evaluatePropertyReplacers(Object object, Object contextObject, Map<String,Object> evaluationParameters)
PropertyReplacer
instances for the component and
evaluates the given condition. If the condition is met, the replacement value is set on the
corresponding property
object
- - object instance with property replacers list, should be either a component or layout managercontextObject
- - context for el evaluationevaluationParameters
- - parameters for el evaluationprotected void evaluatePropertyExpressions(Object object, Object contextObject, Map<String,Object> evaluationParameters)
If the expression is an el template (part static text and part expression), only the expression part will be replaced with the result. More than one expressions may be contained within the template
object
- - object instance to evaluate expressions forcontextObject
- - object providing the default context for expressionsevaluationParameters
- - map of additional parameters that may be used within the expressionspublic boolean containsElPlaceholder(String value)
ExpressionEvaluatorService
containsElPlaceholder
in interface ExpressionEvaluatorService
value
- - String to check for contained placeholders
ExpressionEvaluatorService.containsElPlaceholder(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |