org.xwiki.rendering.transformation
Class TransformationContext

java.lang.Object
  extended by org.xwiki.rendering.transformation.TransformationContext
All Implemented Interfaces:
Cloneable

public class TransformationContext
extends Object
implements Cloneable

The context of the transformation process. Contains information such as the current XWiki DOM for the parsed content.

Since:
2.4M1

Constructor Summary
TransformationContext()
          Default constructor that doesn't set the XDOM or the Syntax.
TransformationContext(XDOM xdom, Syntax syntax)
          Some macros require the XDOM and the Syntax to be set.
TransformationContext(XDOM xdom, Syntax syntax, boolean restricted)
          Some macros require the XDOM and the Syntax to be set.
 
Method Summary
 TransformationContext clone()
           
 String getId()
           
 Syntax getSyntax()
           
 XDOM getXDOM()
           
 boolean isRestricted()
           
 void setId(String id)
           
 void setRestricted(boolean restricted)
           
 void setSyntax(Syntax syntax)
           
 void setXDOM(XDOM xdom)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformationContext

public TransformationContext()
Default constructor that doesn't set the XDOM or the Syntax. This is because setting the XDOM and the Syntax is optional and only required by some Macros to behave as expected.


TransformationContext

public TransformationContext(XDOM xdom,
                             Syntax syntax)
Some macros require the XDOM and the Syntax to be set.

Parameters:
xdom - see setXDOM(org.xwiki.rendering.block.XDOM)
syntax - see setSyntax(org.xwiki.rendering.syntax.Syntax)

TransformationContext

public TransformationContext(XDOM xdom,
                             Syntax syntax,
                             boolean restricted)
Some macros require the XDOM and the Syntax to be set.

Parameters:
xdom - see setXDOM(org.xwiki.rendering.block.XDOM)
syntax - see setSyntax(org.xwiki.rendering.syntax.Syntax)
restricted - disables potentially harmful transformations.
Method Detail

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.
Since:
2.4M2

setId

public void setId(String id)
Parameters:
id - see getId()
Since:
2.4M2

setXDOM

public void setXDOM(XDOM xdom)
Parameters:
xdom - the complete XDOM of the content currently being transformed.

getXDOM

public XDOM getXDOM()
Returns:
the complete XDOM of the content currently being transformed.

setSyntax

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

getSyntax

public Syntax getSyntax()
Returns:
the current syntax.

isRestricted

public boolean isRestricted()
Returns:
indicator of whether the transformation context is restricted or not.

setRestricted

public void setRestricted(boolean restricted)
Parameters:
restricted - set indicator of whether the transformation context is restricted or not.

clone

public TransformationContext clone()
Overrides:
clone in class Object