01: /*
02: * Spoon - http://spoon.gforge.inria.fr/
03: * Copyright (C) 2006 INRIA Futurs <renaud.pawlak@inria.fr>
04: *
05: * This software is governed by the CeCILL-C License under French law and
06: * abiding by the rules of distribution of free software. You can use, modify
07: * and/or redistribute the software under the terms of the CeCILL-C license as
08: * circulated by CEA, CNRS and INRIA at http://www.cecill.info.
09: *
10: * This program is distributed in the hope that it will be useful, but WITHOUT
11: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12: * FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL-C License for more details.
13: *
14: * The fact that you are presently reading this means that you have had
15: * knowledge of the CeCILL-C license and that you accept its terms.
16: */
17:
18: package spoon.template;
19:
20: import spoon.reflect.code.CtCodeElement;
21: import spoon.reflect.declaration.CtSimpleType;
22:
23: /**
24: * This interface defines a typed template parameter. It is parameterized by
25: * <code>T</code>, the type of the template parameter, which can be retrieved
26: * by the {@link #S()} method. For more details on how to use template
27: * parameters, see {@link Template}.
28: */
29: public interface TemplateParameter<T> {
30:
31: /**
32: * Gets the type of the template parameter. This methods has no runtime
33: * meaning (should return a <code>null</code> reference) but is used as a
34: * marker in a template code. When generating a template code, each
35: * invocation of this method will be substituted with the result of the
36: * {@link #getSubstitution(CtSimpleType)} method.
37: */
38: T S();
39:
40: /**
41: * Returns the code which must be substituted to this template parameter,
42: * depending on its value.
43: *
44: * @param targetType
45: * the type that defines the context of the substitution (for
46: * reference redirection).
47: */
48: CtCodeElement getSubstitution(CtSimpleType<?> targetType);
49: }
|