|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.atlassian.confluence.content.render.xhtml.DefaultConversionContext
public class DefaultConversionContext
A non-thread safe implementation of the ConversionContext suitable for use in the single threaded XHTML output process.
Unless explicitly set thegetOutputDeviceType()
will
return ConversionContextOutputDeviceType.DESKTOP
.
Field Summary |
---|
Fields inherited from interface com.atlassian.confluence.content.render.xhtml.ConversionContext |
---|
IS_VALIDATING_COMMENT |
Constructor Summary | |
---|---|
DefaultConversionContext(com.atlassian.renderer.RenderContext renderContext)
|
|
DefaultConversionContext(com.atlassian.renderer.RenderContext renderContext,
String outputDeviceType)
Create a DefaultConversionContext for the specified output device type. |
Method Summary | |
---|---|
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 |
getOutputDeviceType()
Note, that if you want your code to be compatible with versions of Confluence older then 4.3.2 then you can instead call ConversionContext.getPropertyAsString(String) with the parameter "output-device-type". |
String |
getOutputType()
|
PageContext |
getPageContext()
This method should be considered almost deprecated. |
Object |
getProperty(String name)
Return a property from the context. |
Object |
getProperty(String name,
Object defaultValue)
Return a property from the context or the supplied defaultValue if the property does not exist on the context. |
String |
getPropertyAsString(String name)
Returns the property for this key as a String. |
com.atlassian.renderer.RenderContext |
getRenderContext()
Deprecated. Used getPageContext() instead. |
String |
getSpaceKey()
The spacekey for the current context if applicable or null otherwise. |
com.atlassian.util.concurrent.Timeout |
getTimeout()
The Timeout object for this Conversion. |
int |
hashCode()
|
boolean |
hasProperty(String name)
Returns true if the property with the specified key has been set. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultConversionContext(com.atlassian.renderer.RenderContext renderContext)
public DefaultConversionContext(com.atlassian.renderer.RenderContext renderContext, String outputDeviceType)
renderContext
- outputDeviceType
- Method Detail |
---|
@Deprecated public com.atlassian.renderer.RenderContext getRenderContext()
getPageContext()
instead.
public PageContext getPageContext()
ConversionContext
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.
getPageContext
in interface ConversionContext
DefaultConversionContext
public Object removeProperty(String name)
ConversionContext
removeProperty
in interface ConversionContext
name
- The unique key of the property. See ConversionContextPropertyName
for common names.
public void setProperty(String name, Object value)
ConversionContext
setProperty
in interface ConversionContext
name
- A unique key for this property. See ConversionContextPropertyName
for common names.value
- The value of the property.public Object getProperty(String name)
ConversionContext
getProperty
in interface ConversionContext
name
- of the property. See ConversionContextPropertyName
for common names.
public Object getProperty(String name, Object defaultValue)
ConversionContext
getProperty
in interface ConversionContext
name
- the name of the propertydefaultValue
- the default value to return if the property is not found.
public String getPropertyAsString(String name)
ConversionContext
getPropertyAsString
in interface ConversionContext
name
- The key for the property
public boolean hasProperty(String name)
ConversionContext
hasProperty
in interface ConversionContext
name
- The name of the property
public ContentTree getContentTree()
ConversionContext
getContentTree
in interface ConversionContext
public void setContentTree(ContentTree contentTree)
public String getOutputDeviceType()
ConversionContext
ConversionContext.getPropertyAsString(String)
with the parameter "output-device-type". For example, if you
are a plugin developer writing a macro that can target different device types such as mobile, you can
retain a common code base for your mobile and non-mobile implementations by avoiding this method and
calling getPropertyAsString("output-device-type")instead.
getOutputDeviceType
in interface ConversionContext
ConversionContextOutputDeviceType.DESKTOP
but plugins that have their own renderer could use other typespublic String getOutputType()
getOutputType
in interface ConversionContext
ConversionContextOutputType.value()
which indicates the target output type
for the conversion.public com.atlassian.util.concurrent.Timeout getTimeout()
ConversionContext
Timeout.isExpired()
, or how much longer conversion should be allowed to
run using Timeout.getTime()
, Timeout.getUnit()
.
getTimeout
in interface ConversionContext
public void checkTimeout() throws XhtmlTimeoutException
ConversionContext
ConversionContext.getTimeout()
and Timeout.isExpired()
to check the timeout without
throwing an exception.
checkTimeout
in interface ConversionContext
XhtmlTimeoutException
- if the conversion has exceeded its time limit.public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public ContentEntityObject getEntity()
ConversionContext
getEntity
in interface ConversionContext
public String getSpaceKey()
ConversionContext
getSpaceKey
in interface ConversionContext
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |