Class AbstractMacroDescriptor
- java.lang.Object
-
- org.xwiki.rendering.macro.descriptor.AbstractMacroDescriptor
-
- All Implemented Interfaces:
MacroDescriptor
- Direct Known Subclasses:
DefaultMacroDescriptor
public abstract class AbstractMacroDescriptor extends Object implements MacroDescriptor
Describe a macro.- Since:
- 1.6M1
- Version:
- $Id: f3157f69a9908a0e9c34f154ddb9513eb6bbcc68 $
-
-
Constructor Summary
Constructors Constructor Description AbstractMacroDescriptor(MacroId id, String name, String description, ContentDescriptor contentDescriptor, org.xwiki.properties.BeanDescriptor parametersBeanDescriptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
extractParameterDescriptorMap()
Extract parameters informations fromparametersBeanDescriptor
and insert it inparameterDescriptorMap
.ContentDescriptor
getContentDescriptor()
Set<String>
getDefaultCategories()
A macro defines a set of classification categories under which it falls.String
getDescription()
MacroId
getId()
String
getName()
Map<String,ParameterDescriptor>
getParameterDescriptorMap()
Get all the parameters descriptors.Class<?>
getParametersBeanClass()
void
setDefaultCategories(Set<String> defaultCategories)
void
setSupportsInlineMode(boolean supportsInlineMode)
boolean
supportsInlineMode()
-
-
-
Constructor Detail
-
AbstractMacroDescriptor
public AbstractMacroDescriptor(MacroId id, String name, String description, ContentDescriptor contentDescriptor, org.xwiki.properties.BeanDescriptor parametersBeanDescriptor)
- Parameters:
id
- the id of the macroname
- the name of the macro (eg "Table Of Contents" for the TOC macro)description
- the description of the macro.contentDescriptor
- the description of the macro content. null indicate macro does not support content.parametersBeanDescriptor
- the description of the parameters bean or null if there are no parameters for this macro.- Since:
- 2.3M1
-
-
Method Detail
-
extractParameterDescriptorMap
protected void extractParameterDescriptorMap()
Extract parameters informations fromparametersBeanDescriptor
and insert it inparameterDescriptorMap
.- Since:
- 1.7M2
-
getId
public MacroId getId()
- Specified by:
getId
in interfaceMacroDescriptor
- Returns:
- the id of the macro
- Since:
- 2.3M1
-
getName
public String getName()
- Specified by:
getName
in interfaceMacroDescriptor
- Returns:
- the human-readable name of the macro (eg "Table Of Contents" for the TOC macro).
- Since:
- 2.0M3
-
getContentDescriptor
public ContentDescriptor getContentDescriptor()
- Specified by:
getContentDescriptor
in interfaceMacroDescriptor
- Returns:
- describe the macro content. If null the macro does not support content.
-
getDescription
public String getDescription()
- Specified by:
getDescription
in interfaceMacroDescriptor
- Returns:
- the description of the macro.
-
getParametersBeanClass
public Class<?> getParametersBeanClass()
- Specified by:
getParametersBeanClass
in interfaceMacroDescriptor
- Returns:
- the class of the JAVA bean containing macro parameters.
-
getParameterDescriptorMap
public Map<String,ParameterDescriptor> getParameterDescriptorMap()
Description copied from interface:MacroDescriptor
Get all the parameters descriptors.The
Map
key is lower case.ParameterDescriptor.getId()
can be used to access the source parameter identifier (with the source case).- Specified by:
getParameterDescriptorMap
in interfaceMacroDescriptor
- Returns:
- a
Map
containing theParameterDescriptor
for each parameter (the keys are lower cased).
-
setDefaultCategories
@Unstable public void setDefaultCategories(Set<String> defaultCategories)
- Parameters:
defaultCategories
- the list of default categories which the macro should be listed- Since:
- 14.6RC1
- See Also:
MacroDescriptor.getDefaultCategories()
-
getDefaultCategories
public Set<String> getDefaultCategories()
Description copied from interface:MacroDescriptor
A macro defines a set of classification categories under which it falls. For instance, the "skype" macro would fall under the "Communication" and "Video" categories. However, a wiki administrator has the ability to override the default categories for a given macro in order to organize categories as he or she sees fit. Thus, these default categories are only an indication from the macro author about what categories the macro should fall.- Specified by:
getDefaultCategories
in interfaceMacroDescriptor
- Returns:
- the default categories under which this macro should be listed, or the empty list of the macro does not have any default category defined
-
supportsInlineMode
public boolean supportsInlineMode()
- Specified by:
supportsInlineMode
in interfaceMacroDescriptor
- 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.
-
setSupportsInlineMode
public void setSupportsInlineMode(boolean supportsInlineMode)
- Parameters:
supportsInlineMode
-true
to support in-line mode,false
otherwise- Since:
- 10.10RC1
- See Also:
supportsInlineMode()
-
-