Package com.xwiki.macros
Class AbstractProMacro<P>
java.lang.Object
org.xwiki.rendering.macro.AbstractMacro<P>
com.xwiki.macros.AbstractProMacro<P>
- Type Parameters:
P- the type of the macro parameters bean.
- All Implemented Interfaces:
Comparable<org.xwiki.rendering.macro.Macro<?>>,org.xwiki.component.phase.Initializable,org.xwiki.rendering.macro.Macro<P>
- Direct Known Subclasses:
com.xwiki.macros.showhideif.internal.macro.AbstractShowHideIfMacro
@Unstable
public abstract class AbstractProMacro<P>
extends org.xwiki.rendering.macro.AbstractMacro<P>
Helper to implement a Pro macro.
- Since:
- 1.9.1
- Version:
- $Id$
-
Field Summary
Fields inherited from class org.xwiki.rendering.macro.AbstractMacro
beanManager, DEFAULT_CATEGORY_CONTENT, DEFAULT_CATEGORY_DEPRECATED, DEFAULT_CATEGORY_DEVELOPMENT, DEFAULT_CATEGORY_FORMATTING, DEFAULT_CATEGORY_INTERNAL, DEFAULT_CATEGORY_LAYOUT, DEFAULT_CATEGORY_NAVIGATION -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractProMacro(String name, String description, Class<?> parametersBeanClass) Creates a new macro instance.protectedAbstractProMacro(String name, String description, org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor, Class<?> parametersBeanClass) Creates a new macro instance. -
Method Summary
Modifier and TypeMethodDescriptionList<org.xwiki.rendering.block.Block>execute(P parameters, String content, org.xwiki.rendering.transformation.MacroTransformationContext context) Executes the macro.org.xwiki.wiki.descriptor.WikiDescriptorManagerprotected abstract List<org.xwiki.rendering.block.Block>internalExecute(P parameters, String content, org.xwiki.rendering.transformation.MacroTransformationContext context) protected booleanisEditMode(org.xwiki.rendering.transformation.MacroTransformationContext context) Methods inherited from class org.xwiki.rendering.macro.AbstractMacro
compareTo, getDescriptor, getNonGeneratedContentMetaData, getNonGeneratedContentMetaData, getNonGeneratedContentMetaData, getNonGeneratedContentMetaData, getPriority, initialize, setDefaultCategories, setDescriptor, setPriorityMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xwiki.rendering.macro.Macro
prepare, supportsInlineMode
-
Constructor Details
-
AbstractProMacro
protected AbstractProMacro(String name, String description, org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor, Class<?> parametersBeanClass) Creates a new macro instance.- Parameters:
name- the name of the macro.description- the description of the macro.contentDescriptor- the content descriptor of the macro.parametersBeanClass- the class of the parameters bean of this class.
-
AbstractProMacro
Creates a new macro instance.- Parameters:
name- the name of the macro.description- the description of the macro.parametersBeanClass- the class of the parameters bean of this class.
-
-
Method Details
-
execute
public List<org.xwiki.rendering.block.Block> execute(P parameters, String content, org.xwiki.rendering.transformation.MacroTransformationContext context) throws org.xwiki.rendering.macro.MacroExecutionException Executes the macro.- Parameters:
parameters- the macro parameters in the form of a bean defined by theMacroimplementationcontent- 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:
org.xwiki.rendering.macro.MacroExecutionException- when an error occurs during the execution process
-
internalExecute
protected abstract List<org.xwiki.rendering.block.Block> internalExecute(P parameters, String content, org.xwiki.rendering.transformation.MacroTransformationContext context) throws org.xwiki.rendering.macro.MacroExecutionException - Throws:
org.xwiki.rendering.macro.MacroExecutionException
-
getWikiDescriptorManager
public org.xwiki.wiki.descriptor.WikiDescriptorManager getWikiDescriptorManager()- Returns:
- the wiki descriptor manager
-
isEditMode
protected boolean isEditMode(org.xwiki.rendering.transformation.MacroTransformationContext context)
-