public interface ExpressionEvaluatorService
Used within the UI framework to allow conditional logic to be configured through the XML which can alter the values of component properties
Modifier and Type | Method and Description |
---|---|
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 expression)
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
|
void evaluateObjectExpressions(Object object, Object contextObject, Map<String,Object> evaluationParameters)
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
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
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 foundString evaluateExpressionTemplate(Object contextObject, Map<String,Object> evaluationParameters, String expressionTemplate)
If the template string contains one or more el placeholders (see
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
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 expressionsObject evaluateExpression(Object contextObject, Map<String,Object> evaluationParameters, String expression)
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
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 foundexpression
- - el expression to evaluateboolean containsElPlaceholder(String value)
value
- - String to check for contained placeholdersorg.kuali.rice.krad.uif.UifConstants.EL_PLACEHOLDER_PREFIX
,
org.kuali.rice.krad.uif.UifConstants.EL_PLACEHOLDER_SUFFIX
Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.