public class

DefaultConversionContext

extends Object
implements ConversionContext
java.lang.Object
   ↳ com.atlassian.confluence.content.render.xhtml.DefaultConversionContext

Class Overview

A non-thread safe implementation of the ConversionContext suitable for use in the single threaded XHTML output process.

Summary

Public Constructors
DefaultConversionContext(RenderContext renderContext)
Public Methods
void checkTimeout()
Check the timeout and throw an XhtmlTimeoutException if the timeout is expired.
boolean equals(Object o)
ContentTree getContentTree()
If multiple items are being converted in this 'context' then the complete tree of ContentNodes will be retrieved via this method.
ContentEntityObject getEntity()
Get the current ContentEntityObject for this context.
String getOutputType()
PageContext getPageContext()

This method should be considered almost deprecated.

Object getProperty(String name)
Return a property from the context.
String getPropertyAsString(String name)
Returns the property for this key as a String.
@Deprecated RenderContext getRenderContext()
This method is deprecated. Used getPageContext() instead.
String getSpaceKey()
The spacekey for the current context if applicable or null otherwise.
Timeout getTimeout()
The Timeout object for this Conversion.
boolean hasProperty(String name)
Returns true if the property with the specified key has been set.
int hashCode()
Object removeProperty(String name)
Removes the property references by the key from the conversion context and returns it.
void setContentTree(ContentTree contentTree)
void setProperty(String name, Object value)
Sets the property specified by name in the conversion context.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.confluence.content.render.xhtml.ConversionContext

Public Constructors

public DefaultConversionContext (RenderContext renderContext)

Public Methods

public void checkTimeout ()

Check the timeout and throw an XhtmlTimeoutException if the timeout is expired. Use getTimeout() and isExpired() to check the timeout without throwing an exception.

public boolean equals (Object o)

public ContentTree getContentTree ()

If multiple items are being converted in this 'context' then the complete tree of ContentNodes will be retrieved via this method. If only a single item is being converted in the context then a ContentTree containing a single ContentNode will be returned.

Returns
  • a ContentTree representing all the items being converted in this context. An empty ContentTree may be returned if there is no explicit content being converted in this context.

public ContentEntityObject getEntity ()

Get the current ContentEntityObject for this context.

Returns
  • The ContentEntityObject for this context.

public String getOutputType ()

public PageContext getPageContext ()

This method should be considered almost deprecated.

At the moment a ConversionContext implementation will always be wrapping at least a RenderContext and as long as this is actually a PageContext then it will be returned by this method. However, at some point in the future ConversionContext will be decoupled from the old v2 RenderContext and this method will be removed.

Returns
  • the underlying PageContext wrapped by the ConversionContext.

public Object getProperty (String name)

Return a property from the context.

Parameters
name of the property. See ConversionContextPropertyName for common names.
Returns
  • a property from the context.

public String getPropertyAsString (String name)

Returns the property for this key as a String. toString() will be called if this is not the java.lang.String class. null will be returned if this property does not exist.

Parameters
name The key for the property
Returns
  • The String value of the property or null if the property does not exist.

@Deprecated public RenderContext getRenderContext ()

This method is deprecated.
Used getPageContext() instead.

public String getSpaceKey ()

The spacekey for the current context if applicable or null otherwise.

Returns
  • The spacekey or null.

public Timeout getTimeout ()

The Timeout object for this Conversion. This can be checked to see if conversion should be terminated using isExpired(), or how much longer conversion should be allowed to run using getTime(), getUnit().

Returns
  • the timeout to perform the conversion.

public boolean hasProperty (String name)

Returns true if the property with the specified key has been set.

Parameters
name The name of the property
Returns
  • True if the property exists in this context.

public int hashCode ()

public Object removeProperty (String name)

Removes the property references by the key from the conversion context and returns it.

Parameters
name The unique key of the property. See ConversionContextPropertyName for common names.
Returns
  • The property from the conversion context.

public void setContentTree (ContentTree contentTree)

public void setProperty (String name, Object value)

Sets the property specified by name in the conversion context.

Parameters
name A unique key for this property. See ConversionContextPropertyName for common names.
value The value of the property.