public class DefaultConversionContext extends Object implements ConversionContext
Unless explicitly set the getOutputDeviceType() will
return ConversionContextOutputDeviceType.DESKTOP.
IS_VALIDATING_COMMENT| Constructor and Description |
|---|
DefaultConversionContext(com.atlassian.renderer.RenderContext renderContext) |
DefaultConversionContext(com.atlassian.renderer.RenderContext renderContext,
String outputDeviceType)
Create a DefaultConversionContext for the specified output device type.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMarshallerMetricsConsumer(MarshallerMetricsConsumer consumer)
Adds a consumer of
MarshallerMetrics
that is associated with the current render. |
void |
checkTimeout()
Check the timeout and throw an XhtmlTimeoutException if the timeout is expired.
|
void |
disableAsyncRenderSafe()
Mark the content rendered in this context as non-async-render-safe
|
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.
|
Map<String,Object> |
getImmutableProperties()
The properties returned in this map are guaranteed to be immutable, they are not guaranteed
to all be present.
|
Set<MarshallerMetricsConsumer> |
getMarshallerMetricsConsumers()
Returns the consumers of
MarshallerMetrics
that are associated with the current render. |
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". |
@NonNull String |
getOutputType() |
PageContext |
getPageContext() |
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() |
String |
getSpaceKey()
The spacekey for the current context if applicable or null otherwise.
|
PageTemplate |
getTemplate() |
com.atlassian.util.concurrent.Timeout |
getTimeout()
Deprecated.
since 7.0.1. Use
ConversionContext.timeout() |
int |
hashCode() |
boolean |
hasProperty(String name)
Returns true if the property with the specified key has been set.
|
com.google.common.collect.ImmutableMap<String,Object> |
immutableProperties()
Deprecated.
since 7.0.1. Use
getImmutableProperties() |
boolean |
isAsyncRenderSafe() |
boolean |
isDiffOrEmail()
Check if the current context is
ConversionContextOutputType.DIFF
or ConversionContextOutputType.EMAIL |
boolean |
removeMarshallerMetricsConsumer(MarshallerMetricsConsumer consumer)
Removes a consumer of
MarshallerMetrics
that is associated with the current render. |
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.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waittimeoutpublic DefaultConversionContext(com.atlassian.renderer.RenderContext renderContext)
public DefaultConversionContext(com.atlassian.renderer.RenderContext renderContext,
String outputDeviceType)
renderContext - outputDeviceType - @Deprecated public com.google.common.collect.ImmutableMap<String,Object> immutableProperties()
getImmutableProperties()public Map<String,Object> getImmutableProperties()
public PageContext getPageContext()
getPageContext in interface ConversionContextDefaultConversionContextpublic com.atlassian.renderer.RenderContext getRenderContext()
getRenderContext in interface ConversionContextpublic Object removeProperty(String name)
ConversionContextremoveProperty in interface ConversionContextname - The unique key of the property. See ConversionContextPropertyName for common names.public void setProperty(String name, Object value)
ConversionContextsetProperty in interface ConversionContextname - A unique key for this property. See ConversionContextPropertyName for common names.value - The value of the property.public Object getProperty(String name)
ConversionContextgetProperty in interface ConversionContextname - of the property. See ConversionContextPropertyName for common names.public Object getProperty(String name, Object defaultValue)
ConversionContextgetProperty in interface ConversionContextname - the name of the propertydefaultValue - the default value to return if the property is not found.public String getPropertyAsString(String name)
ConversionContexttoString() will be called if this is not the java.lang.String class.
null will be returned if this property does not exist.
getPropertyAsString in interface ConversionContextname - The key for the propertypublic boolean hasProperty(String name)
ConversionContexthasProperty in interface ConversionContextname - The name of the propertypublic ContentTree getContentTree()
ConversionContextgetContentTree in interface ConversionContextpublic void setContentTree(ContentTree contentTree)
public String getOutputDeviceType()
ConversionContextConversionContext.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 ConversionContextConversionContextOutputDeviceType.DESKTOP
but plugins that have their own renderer could use other typespublic @NonNull String getOutputType()
getOutputType in interface ConversionContextConversionContextOutputType.value() which indicates the target output type
for the conversion.public boolean isAsyncRenderSafe()
isAsyncRenderSafe in interface ConversionContextpublic void disableAsyncRenderSafe()
disableAsyncRenderSafe in interface ConversionContext@Deprecated public com.atlassian.util.concurrent.Timeout getTimeout()
ConversionContext.timeout()ConversionContextTimeout.isExpired(), or how much longer conversion should be allowed to
run using Timeout.getTime(), Timeout.getUnit().getTimeout in interface ConversionContextpublic void checkTimeout()
throws XhtmlTimeoutException
ConversionContextConversionContext.timeout() and Timeout.isExpired() to check the timeout without
throwing an exception.checkTimeout in interface ConversionContextXhtmlTimeoutException - if the conversion has exceeded its time limit.public boolean isDiffOrEmail()
ConversionContextConversionContextOutputType.DIFF
or ConversionContextOutputType.EMAILisDiffOrEmail in interface ConversionContextpublic void addMarshallerMetricsConsumer(MarshallerMetricsConsumer consumer)
ConversionContextMarshallerMetrics
that is associated with the current render. These consumers are used instead of event listeners because their
scope of interest is limited to a particular thread.addMarshallerMetricsConsumer in interface ConversionContextpublic boolean removeMarshallerMetricsConsumer(MarshallerMetricsConsumer consumer)
ConversionContextMarshallerMetrics
that is associated with the current render.removeMarshallerMetricsConsumer in interface ConversionContextpublic Set<MarshallerMetricsConsumer> getMarshallerMetricsConsumers()
ConversionContextMarshallerMetrics
that are associated with the current render. These consumers are used instead of event listeners because their
scope of interest is limited to a particular thread.getMarshallerMetricsConsumers in interface ConversionContextpublic ContentEntityObject getEntity()
ConversionContextgetEntity in interface ConversionContextpublic PageTemplate getTemplate()
getTemplate in interface ConversionContextpublic String getSpaceKey()
ConversionContextgetSpaceKey in interface ConversionContextCopyright © 2003–2021 Atlassian. All rights reserved.