Interface SyntaxRegistry


  • @Unstable
    @Role
    public interface SyntaxRegistry
    Register, unregister and list syntaxes available in the wiki. Syntaxes can be automatically registered by implementing the javax.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 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
      • getSyntaxes

        Map<String,​Syntax> getSyntaxes()
        Returns:
        the list of available Syntaxes
      • getSyntax

        Optional<Syntax> getSyntax​(String syntaxId)
        Parameters:
        syntaxId - the syntax represented as a string (e.g. xwiki/2.1)
        Returns:
        the Syntax object taken from the list of already registered Syntaxes and Optional.empty() if not found
      • resolveSyntax

        Syntax resolveSyntax​(String syntaxId)
                      throws ParseException
        Parse the provided string representation of a Syntax and return a typed Syntax object.
        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