|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Macro | Line # 35 | 0 | - | 0 | 0 | - |
-1.0
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
No Tests | |||
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.rendering.macro; | |
21 | ||
22 | import java.util.List; | |
23 | ||
24 | import org.xwiki.component.annotation.ComponentRole; | |
25 | import org.xwiki.rendering.block.Block; | |
26 | import org.xwiki.rendering.macro.descriptor.MacroDescriptor; | |
27 | import org.xwiki.rendering.transformation.MacroTransformationContext; | |
28 | ||
29 | /** | |
30 | * @param <P> the type of the macro parameters bean | |
31 | * @version $Id$ | |
32 | * @since 1.5M2 | |
33 | */ | |
34 | @ComponentRole | |
35 | public interface Macro<P> extends Comparable<Macro< ? >> | |
36 | { | |
37 | /** | |
38 | * The priority of execution relative to the other Macros. The lowest values have the highest priorities and execute | |
39 | * first. For example a Macro with a priority of 100 will execute before one with a priority of 500. | |
40 | * | |
41 | * @return the execution priority | |
42 | */ | |
43 | int getPriority(); | |
44 | ||
45 | /** | |
46 | * @return the macro descriptor | |
47 | */ | |
48 | MacroDescriptor getDescriptor(); | |
49 | ||
50 | /** | |
51 | * @return true if the macro can be inserted in some existing content such as a paragraph, a list item etc. For | |
52 | * example if I have <code>== hello {{velocity}}world{{/velocity}}</code> then the Velocity macro must | |
53 | * support the inline mode and not generate a paragraph. | |
54 | */ | |
55 | boolean supportsInlineMode(); | |
56 | ||
57 | /** | |
58 | * Executes the macro. | |
59 | * | |
60 | * @param parameters the macro parameters in the form of a bean defined by the {@link Macro} implementation | |
61 | * @param content the content of the macro | |
62 | * @param context the context of the macros transformation process | |
63 | * @return the result of the macro execution as a list of Block elements | |
64 | * @throws MacroExecutionException error when executing the macro | |
65 | */ | |
66 | List<Block> execute(P parameters, String content, MacroTransformationContext context) | |
67 | throws MacroExecutionException; | |
68 | } |
|