Class MacroTransformationContext

  • All Implemented Interfaces:
    Cloneable

    public class MacroTransformationContext
    extends Object
    implements Cloneable
    The context of the macro transformation process. Contains information such as the current XWiki DOM for the parsed content and the current Macro block being processed by the Macro transformation.
    Version:
    $Id: cc5af9ebda2ccc51c51c4305fa19b06f5275ed2e $
    • Constructor Detail

      • MacroTransformationContext

        public MacroTransformationContext()
        Constructor.
      • MacroTransformationContext

        public MacroTransformationContext​(TransformationContext transformationContext)
        Constructor.
        Parameters:
        transformationContext - the context of the transformation process.
        Since:
        2.4M1
    • Method Detail

      • getTransformationContext

        public TransformationContext getTransformationContext()
        Returns:
        the context of the transformation process.
        Since:
        2.4M1
      • setCurrentMacroBlock

        public void setCurrentMacroBlock​(MacroBlock currentMacroBlock)
        Parameters:
        currentMacroBlock - the macro currently being processed.
      • getCurrentMacroBlock

        public MacroBlock getCurrentMacroBlock()
        Returns:
        the macro currently being processed.
      • setXDOM

        public void setXDOM​(XDOM xdom)
        Parameters:
        xdom - the complete XDOM of the page currently being transformed.
      • getXDOM

        public XDOM getXDOM()
        Returns:
        the complete XDOM of the page currently being transformed.
      • setInline

        public void setInline​(boolean inline)
        Parameters:
        inline - if true then the macro is called in inline mode
      • isInline

        public boolean isInline()
        Returns:
        true if the macro is called in inline mode (ie inside a paragraph, a list item, etc)
      • setTransformation

        public void setTransformation​(Transformation transformation)
        Parameters:
        transformation - the Transformation being used
        Since:
        2.4M1
        See Also:
        getTransformation()
      • getTransformation

        public Transformation getTransformation()
        Returns:
        the current Transformation instance being executed. Useful for Macros which need to perform other transformations in turn such as the Include macro which needs to execute the transformation if the included page should be executed in its own context.
        Since:
        2.4M1
      • setSyntax

        public void setSyntax​(Syntax syntax)
        Parameters:
        syntax - the current syntax.
      • getSyntax

        public Syntax getSyntax()
        Returns:
        the current syntax.
      • getId

        public String getId()
        Returns:
        an id representing the transformation being evaluated. It's a free form name that Transformations can use, for example if they need to perform some caching based on a key. For example the Velocity Macro is using this id to pass it to the underlying Velocity Engine so that it caches macros using this key.
      • setId

        public void setId​(String id)
        Parameters:
        id - see getId()