KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > spoon > template > TemplateParameter


1 package spoon.template;
2
3 import spoon.reflect.code.CtCodeElement;
4 import spoon.reflect.declaration.CtSimpleType;
5
6 /**
7  * This interface defines a typed template parameter. It is parameterized by
8  * <code>T</code>, the type of the template parameter, which can be retrieved
9  * by the {@link #S()} method. For more details on how to use template
10  * parameters, see {@link Template}.
11  */

12 public interface TemplateParameter<T> {
13
14     /**
15      * Gets the type of the template parameter. This methods has no runtime
16      * meaning (should return a <code>null</code> reference) but is used as a
17      * marker in a template code. When generating a template code, each
18      * invocation of this method will be substituted with the result of the
19      * {@link #getSubstitution(CtSimpleType)} method.
20      */

21     T S();
22
23     /**
24      * Returns the code which must be substituted to this template parameter,
25      * depending on its value.
26      *
27      * @param targetType the type that defines the context of the substitution
28      * (for reference redirection).
29      */

30     CtCodeElement getSubstitution(CtSimpleType<?> targetType);
31 }
32
Popular Tags