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 Rendering Blocks, 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 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 the Macro implementation
        content - the content of the macro
        context - 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