Package org.xwiki.rendering.macro
Interface Macro<P>
-
- Type Parameters:
P
- the type of the macro parameters bean
- All Superinterfaces:
Comparable<Macro<?>>
- All Known Implementing Classes:
AbstractMacro
,AbstractNoParameterMacro
@ComponentRole public interface Macro<P> extends Comparable<Macro<?>>
Represents a Macro, ie a mechanism to generate RenderingBlock
s, that we use as a way to either generate dynamic content or simply as a way to reuse Blocks in content.- Since:
- 1.5M2
- Version:
- $Id: 6a5f0943063c6139ccc474ebd46ec6184de33560 $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<Block>
execute(P parameters, String content, MacroTransformationContext context)
Executes the macro.MacroDescriptor
getDescriptor()
int
getPriority()
The priority of execution relative to the other Macros.boolean
supportsInlineMode()
-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
getPriority
int getPriority()
The priority of execution relative to the other Macros. The lowest values have the highest priorities and execute first. For example a Macro with a priority of 100 will execute before one with a priority of 500.- Returns:
- the execution priority
-
getDescriptor
MacroDescriptor getDescriptor()
- Returns:
- the macro descriptor
-
supportsInlineMode
boolean supportsInlineMode()
- Returns:
- true if the macro can be inserted in some existing content such as a paragraph, a list item etc. For
example if I have
== hello {{velocity}}world{{/velocity}}
then the Velocity macro must support the inline mode and not generate a paragraph.
-
execute
List<Block> execute(P parameters, String content, MacroTransformationContext context) throws MacroExecutionException
Executes the macro.- Parameters:
parameters
- the macro parameters in the form of a bean defined by theMacro
implementationcontent
- the content of the macrocontext
- the context of the macros transformation process- Returns:
- the result of the macro execution as a list of Block elements
- Throws:
MacroExecutionException
- error when executing the macro
-
-