org.xwiki.rendering.macro
Interface MacroManager
- All Known Implementing Classes:
- DefaultMacroManager
@Role
public interface MacroManager
Allow retrieving and test the existence of macros. Macros can be available for all syntaxes or only available for
a given syntax.
Indeed, a macro can be registered and thus made available for all syntaxes or only available for a given syntax.
The latter is useful for example if we want to support copy pasting wiki content from another wiki and we want to
support transparently the macros defined in that content; in this case we could implement these macros only for that
syntax and in the implementation make the bridge with XWiki macros for example.
- Since:
- 1.9M1
getMacroIds
Set<MacroId> getMacroIds()
throws MacroLookupException
- Returns:
- all the available macros whether they are registered for a given syntax or for all syntaxes
- Throws:
MacroLookupException
- error when lookup macros- Since:
- 2.03M
getMacroIds
Set<MacroId> getMacroIds(Syntax syntax)
throws MacroLookupException
- Parameters:
syntax
- the desired syntax
- Returns:
- the available macro ids for the desired syntax (this includes macros registered for all syntaxes and
macros registered only for a given syntax)
- Throws:
MacroLookupException
- error when lookup macros- Since:
- 2.03M
getMacro
Macro<?> getMacro(MacroId macroId)
throws MacroLookupException
- Parameters:
macroId
- the id of the macro to lookup
- Returns:
- the macro, looked-up first as a macro for the desired syntax identifier (if any is specified in the
MacroId) and then as a macro registered for all syntaxes if not found
- Throws:
MacroLookupException
- when no macro with such id was found in both the list of macro for the specified
syntax identifier and for all syntaxes- Since:
- 2.03M
exists
boolean exists(MacroId macroId)
- Parameters:
macroId
- the id of the macro to lookup
- Returns:
- true if a macro with the given id and for the given syntax can be found (if any is specified in the
MacroId), false otherwise. Returns false if a macro with the given id exists but has been registered
only for all syntaxes
- Since:
- 2.03M