public abstract class ExpressionTemplate<T> extends Object implements TemplateParameter<T>, Template
To define a new expression template parameter, you must subclass this class
and implement the expression()
method, which actually defines the
Java expression. It corresponds to a CtExpression
.
Constructor and Description |
---|
ExpressionTemplate()
Creates a new expression template parameter.
|
Modifier and Type | Method and Description |
---|---|
abstract T |
expression()
This method must be implemented to define the template expression.
|
static <T> CtExpression<T> |
getExpression(CtClass<? extends ExpressionTemplate<?>> p)
Returns the expression.
|
CtExpression<T> |
getSubstitution(CtSimpleType<?> targetType)
Returns the code which must be substituted to this template parameter,
depending on its value.
|
T |
S()
Gets the type of the template parameter.
|
public ExpressionTemplate()
public static <T> CtExpression<T> getExpression(CtClass<? extends ExpressionTemplate<?>> p)
public abstract T expression() throws Throwable
Throwable
public CtExpression<T> getSubstitution(CtSimpleType<?> targetType)
TemplateParameter
getSubstitution
in interface TemplateParameter<T>
targetType
- the type that defines the context of the substitution (for
reference redirection).public T S()
TemplateParameter
null
reference) but is used as a
marker in a template code. When generating a template code, each
invocation of this method will be substituted with the result of the
TemplateParameter.getSubstitution(CtSimpleType)
method.S
in interface TemplateParameter<T>
Copyright © 2007–2014 Inria. All rights reserved.