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.support.template;
19:
20: import spoon.reflect.declaration.CtElement;
21: import spoon.reflect.reference.CtReference;
22: import spoon.template.TemplateMatcher;
23:
24: /**
25: * Allows the definition of a specific matching policy for a given template
26: * parameter. When using {@link spoon.template.TemplateMatcher}, parameters are
27: * by default matched to anything. Defining a new type and precising it in the
28: * {@link spoon.template.Parameter} annotation allows to precise the form that
29: * the parameter will match.
30: *
31: * <p>
32: * Note that this feature is not yet fully supported but will be in a close
33: * future.
34: */
35: public interface ParameterMatcher {
36:
37: /**
38: * To be defined to implement a matching strategy for template parameter(s).
39: *
40: * @param templateMatcher
41: * the instance of the matcher that is currently performing the
42: * matching (up-caller)
43: * @param template
44: * the template element to match against
45: * @param toMatch
46: * the element to be tested for a match
47: * @return true if matching
48: */
49: boolean match(TemplateMatcher templateMatcher, CtElement template,
50: CtElement toMatch);
51:
52: /**
53: * To be defined to implement a matching strategy for template parameter(s).
54: *
55: * @param templateMatcher
56: * the instance of the matcher that is currently performing the
57: * matching (up-caller)
58: * @param template
59: * the template reference to match against
60: * @param toMatch
61: * the reference to be tested for a match
62: * @return true if matching
63: */
64: boolean match(TemplateMatcher templateMatcher,
65: CtReference template, CtReference toMatch);
66:
67: }
|