org.xwiki.rendering.transformation
Class MacroTransformationContext

java.lang.Object
  extended by org.xwiki.rendering.transformation.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$

Constructor Summary
MacroTransformationContext()
          Constructor.
MacroTransformationContext(TransformationContext transformationContext)
          Constructor.
 
Method Summary
 MacroTransformationContext clone()
           
 MacroBlock getCurrentMacroBlock()
           
 String getId()
           
 Syntax getSyntax()
           
 Transformation getTransformation()
           
 TransformationContext getTransformationContext()
           
 XDOM getXDOM()
           
 boolean isInline()
           
 void setCurrentMacroBlock(MacroBlock currentMacroBlock)
           
 void setId(String id)
           
 void setInline(boolean isInline)
           
 void setSyntax(Syntax syntax)
           
 void setTransformation(Transformation transformation)
           
 void setXDOM(XDOM xdom)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 isInline)
Parameters:
isInline - 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()

clone

public MacroTransformationContext clone()
Overrides:
clone in class Object


Copyright © 2004-2012 XWiki. All Rights Reserved.