Package org.xwiki.rendering.syntax
Interface SyntaxRegistry
-
@Unstable @Role public interface SyntaxRegistryRegister, unregister and list syntaxes available in the wiki. Syntaxes can be automatically registered by implementing thejavax.inject.Provider<List<Syntax>>component role (and they are automatically unregistered when the component is unregistered from the Component Manager). If a syntax is registered manually by calling a register method from this class, then it also needs to be unregistered manually when the extension bringing it is uninstalled.- Since:
- 13.3RC1
- Version:
- $Id: 5c3962e4ed60245d6cf7afbd389121c1ba3077fb $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<Syntax>getSyntax(String syntaxId)Map<String,Syntax>getSyntaxes()voidregisterSyntaxes(Syntax... syntaxes)Adds one or several Syntaxes to the Syntax Registry.SyntaxresolveSyntax(String syntaxId)Parse the provided string representation of a Syntax and return a typedSyntaxobject.voidunregisterSyntaxes(Syntax... syntaxes)Removes one or several Syntaxes from the Syntax Registry.
-
-
-
Method Detail
-
registerSyntaxes
void registerSyntaxes(Syntax... syntaxes)
Adds one or several Syntaxes to the Syntax Registry.- Parameters:
syntaxes- the syntaxes to add
-
unregisterSyntaxes
void unregisterSyntaxes(Syntax... syntaxes)
Removes one or several Syntaxes from the Syntax Registry.- Parameters:
syntaxes- the syntaxes to remove
-
getSyntax
Optional<Syntax> getSyntax(String syntaxId)
- Parameters:
syntaxId- the syntax represented as a string (e.g.xwiki/2.1)- Returns:
- the
Syntaxobject taken from the list of already registered Syntaxes andOptional.empty()if not found
-
resolveSyntax
Syntax resolveSyntax(String syntaxId) throws ParseException
Parse the provided string representation of a Syntax and return a typedSyntaxobject.- Parameters:
syntaxId- the syntax represented as a string (e.g.xwiki/2.1)- Returns:
- the Syntax from the registry if found and otherwise construct a Syntax object based on the string representation (but with a syntax type name equal to the syntax type id since the information is not present in the string representation).
- Throws:
ParseException- when the passed syntax is invalid
-
-