Interface TemplateContent


  • public interface TemplateContent
    The content of a template.
    Since:
    7.0M1
    Version:
    $Id: 9066635e5cf1e65aa558c8a2f6d1eb40cc90563a $
    • Method Detail

      • getContent

        String getContent()
        Returns:
        the source of the template
      • getSourceSyntax

        org.xwiki.rendering.syntax.Syntax getSourceSyntax()
        Returns:
        the syntax of the content
      • getRawSyntax

        org.xwiki.rendering.syntax.Syntax getRawSyntax()
        Returns:
        the syntax so set in the RawBlock, note taken into account if a source syntax is provided
      • getProperty

        <T> T getProperty​(String name,
                          Type type)
        Return custom property with the provided name and converted (if needed) to the passed type.
        Type Parameters:
        T - the type of the value to return
        Parameters:
        name - the name of the property
        type - the type of the property
        Returns:
        the property value in the provided type or null if none could be found
      • getProperty

        <T> T getProperty​(String name,
                          T def)
        Return custom property with the provided name and converted (if needed) to the passed default value type. If the property does not exist the default value is returned.
        Type Parameters:
        T - the type of the value to return
        Parameters:
        name - the name of the property
        def - the default value
        Returns:
        the property value in the provided default value type or the provided default value if none could be found
      • getAuthorReference

        DocumentReference getAuthorReference()
        Returns:
        the author of the template
      • isAuthorProvided

        default boolean isAuthorProvided()
        Returns:
        used to make the difference between null author and no author
        Since:
        9.4RC1
      • getDocumentReference

        default DocumentReference getDocumentReference()
        Returns:
        the reference of the document to use as secure document (generally the document containing the code to execute) or null if the template is not associated with any document (for example filesystem template)
        Since:
        10.11RC1
      • isCacheAllowed

        default boolean isCacheAllowed()
        Returns:
        true if the result be reused several times
        Since:
        11.8RC1
      • isAsyncAllowed

        default boolean isAsyncAllowed()
        Returns:
        true if the execution should be asynchronous when possible
        Since:
        11.8RC1
      • getContextEntries

        default Set<String> getContextEntries()
        Returns:
        the list of context entries to take remember for the execution
        Since:
        11.8RC1
      • getUnique

        default TemplateContent.UniqueContext getUnique()
        Returns:
        true if the template should be executed only once even if referenced several times
        Since:
        11.8RC1