|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Expression
An Expression can return a TemplateModel value. An expression is used whenever we want to interact with the template models. An expression can be simple, such as an identifier, or more complex, such as a dynamic key name or a concatenation operator.
Expressions can be (in fact, usually are) nested. For instance, a comparison of two concatenation operations may be represented as follows:
Equals
|
+----------------+---------------+
| |
|Plus | Plus
+----+----+ +-----+-----+
| | | |
| | | |
identifier identifier identifier + dynamic-key-name
|
|
+ identifier
Each node on the tree represents a different expression object.
Once complete (i.e. parsed), expressions should be considered immutable.
| Method Summary | |
|---|---|
TemplateModel |
getAsTemplateModel(TemplateWriteableHashModel modelRoot)
The TemplateModel value of this
Expression. |
int |
getType()
Determine the type of result that can be calculated by this expression. |
boolean |
isComplete()
Is the Expression complete? |
boolean |
isConstant()
Determine whether result calculated by this expression is a constant value. |
Expression |
resolveExpression()
Resolves the current expression, possibly into a different expression object. |
| Method Detail |
|---|
TemplateModel getAsTemplateModel(TemplateWriteableHashModel modelRoot)
throws TemplateException
TemplateModel value of this
Expression.
modelRoot - the template model that will be evaluated by the expression
TemplateException - the expression could not be evaluated for some reasonboolean isComplete()
Expression complete?
true if this Expression is complete,
otherwise falseint getType()
ExpressionUtils class.
boolean isConstant()
Expression resolveExpression()
throws TemplateException
readResolve method. Situations where this may be used are:
TemplateException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||