1 /*
2 * This file is part of Pease Plate Template Engine.
3 *
4 * Pease Plate Template Engine is free software: you can redistribute
5 * it and/or modify it under the terms of the GNU Lesser General
6 * Public License as published by the Free Software Foundation,
7 * either version 3 of the License, or any later version.
8 *
9 * Pease Plate Template Engine is distributed in the hope that it
10 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
11 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with Pease Plate Template Engine. If not, see
16 * <http://www.gnu.org/licenses/>.
17 *
18 * Copyright (c) 2008 Manfred HANTSCHEL
19 */
20 package org.peaseplate;
21
22 import java.io.Writer;
23 import java.lang.annotation.ElementType;
24 import java.lang.annotation.Retention;
25 import java.lang.annotation.RetentionPolicy;
26 import java.lang.annotation.Target;
27
28 /**
29 * Signs a class or a method as macro.
30 *
31 * If used on type level you can use the value attribute to specify
32 * the name of the macro. If omitted, the name will be the
33 * class name by trimming "macro" or "macros" at the end.
34 * There is no need to use the Macro annotation on type level,
35 * but you have to annotate the methods.
36 *
37 * If used on method level you can use the value attribute to specify
38 * the name of the macro method. If omitted, the name will be the
39 * name of the method.
40 *
41 * The annotated methods must conform the following rules:
42 *
43 * <ul>
44 * <li>The method must have no return value</li>
45 * <li>The first parameter must be a {@link RenderContext}</li>
46 * <li>The second parameter must be a {@link Writer}</li>
47 * </ul>
48 *
49 * Any following parameters can be of any type and will be passed from the template.
50 *
51 * @author Manfred HANTSCHEL
52 */
53 @Target({ElementType.TYPE, ElementType.METHOD})
54 @Retention(RetentionPolicy.RUNTIME)
55 public @interface Macro {
56
57 String value() default "";
58
59 }