Interface ConversionContext
- 
- All Known Implementing Classes:
- DefaultConversionContext
 
 public interface ConversionContext- Since:
- 4.0
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringIS_VALIDATING_COMMENTThis property will be set when validating a comment.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voidaddMarshallerMetricsConsumer(MarshallerMetricsConsumer consumer)Adds a consumer ofMarshallerMetricsthat is associated with the current render.voidcheckTimeout()Check the timeout and throw an XhtmlTimeoutException if the timeout is expired.voiddisableAsyncRenderSafe()Mark the content rendered in this context as non-async-render-safeContentTreegetContentTree()If multiple items are being converted in this 'context' then the complete tree of ContentNodes will be retrieved via this method.@Nullable ContentEntityObjectgetEntity()Get the current ContentEntityObject for this context.Set<MarshallerMetricsConsumer>getMarshallerMetricsConsumers()Returns the consumers ofMarshallerMetricsthat are associated with the current render.StringgetOutputDeviceType()Note, that if you want your code to be compatible with versions of Confluence older then 4.3.2 then you can instead callgetPropertyAsString(String)with the parameter "output-device-type".@NonNull StringgetOutputType()PageContextgetPageContext()Deprecated.since 7.5.0, usegetRenderContext()instead.ObjectgetProperty(String name)Return a property from the context.ObjectgetProperty(String name, Object defaultValue)Return a property from the context or the supplied defaultValue if the property does not exist on the context.StringgetPropertyAsString(String name)Returns the property for this key as a String.default com.atlassian.renderer.RenderContextgetRenderContext()StringgetSpaceKey()The spacekey for the current context if applicable or null otherwise.default @Nullable PageTemplategetTemplate()com.atlassian.util.concurrent.TimeoutgetTimeout()Deprecated.since 7.0.1.booleanhasProperty(String name)Returns true if the property with the specified key has been set.booleanisAsyncRenderSafe()booleanisDiffOrEmail()Check if the current context isConversionContextOutputType.DIFForConversionContextOutputType.EMAILbooleanremoveMarshallerMetricsConsumer(MarshallerMetricsConsumer consumer)Removes a consumer ofMarshallerMetricsthat is associated with the current render.ObjectremoveProperty(String name)Removes the property references by the key from the conversion context and returns it.voidsetProperty(String name, Object value)Sets the property specified by name in the conversion context.default io.atlassian.util.concurrent.Timeouttimeout()The Timeout object for this Conversion.
 
- 
- 
- 
Field Detail- 
IS_VALIDATING_COMMENTstatic final String IS_VALIDATING_COMMENT This property will be set when validating a comment.- Since:
- 4.3
 
 
- 
 - 
Method Detail- 
setPropertyvoid setProperty(String name, Object value) Sets the property specified by name in the conversion context.- Parameters:
- name- A unique key for this property. See- ConversionContextPropertyNamefor common names.
- value- The value of the property.
 
 - 
getPageContext@Deprecated PageContext getPageContext() Deprecated.since 7.5.0, usegetRenderContext()instead.- Returns:
- the underlying PageContext wrapped by the ConversionContext.
- See Also:
- DefaultConversionContext
 
 - 
getRenderContextdefault com.atlassian.renderer.RenderContext getRenderContext() 
 - 
removePropertyObject 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- ConversionContextPropertyNamefor common names.
- Returns:
- The property from the conversion context.
 
 - 
getPropertyObject getProperty(String name) Return a property from the context.- Parameters:
- name- of the property. See- ConversionContextPropertyNamefor common names.
- Returns:
- a property from the context.
 
 - 
getPropertyObject getProperty(String name, Object defaultValue) Return a property from the context or the supplied defaultValue if the property does not exist on the context.- Parameters:
- name- the name of the property
- defaultValue- the default value to return if the property is not found.
- Returns:
- the value of the found property or the default value if not found.
 
 - 
getPropertyAsStringString 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.
 
 - 
hasPropertyboolean 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.
 
 - 
getContentTreeContentTree 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.
 
 - 
getOutputDeviceTypeString getOutputDeviceType() Note, that if you want your code to be compatible with versions of Confluence older then 4.3.2 then you can instead callgetPropertyAsString(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 callinggetPropertyAsString("output-device-type")instead.- Returns:
- the output device type. Typically this would be ConversionContextOutputDeviceType.DESKTOPbut plugins that have their own renderer could use other types
- Since:
- 4.3.2
 
 - 
getOutputType@NonNull String getOutputType() - Returns:
- one of the Strings returned by ConversionContextOutputType.value()which indicates the target output type for the conversion.
 
 - 
isAsyncRenderSafeboolean isAsyncRenderSafe() - Returns:
- true if the content is safe to render in asynchronously, e.g. dynamically on a page without a page refresh.
- Since:
- 5.6
 
 - 
disableAsyncRenderSafevoid disableAsyncRenderSafe() Mark the content rendered in this context as non-async-render-safe- Since:
- 5.6
 
 - 
getEntity@Nullable ContentEntityObject getEntity() Get the current ContentEntityObject for this context.- Returns:
- The ContentEntityObject for this context.
 
 - 
getTemplatedefault @Nullable PageTemplate getTemplate() 
 - 
getSpaceKeyString getSpaceKey() The spacekey for the current context if applicable or null otherwise.- Returns:
- The spacekey or null.
 
 - 
getTimeout@Deprecated com.atlassian.util.concurrent.Timeout getTimeout() Deprecated.since 7.0.1. Usetimeout()The Timeout object for this Conversion. This can be checked to see if conversion should be terminated usingTimeout.isExpired(), or how much longer conversion should be allowed to run usingTimeout.getTime(),Timeout.getUnit().- Returns:
- the timeout to perform the conversion.
 
 - 
timeoutdefault io.atlassian.util.concurrent.Timeout timeout() The Timeout object for this Conversion. This can be checked to see if conversion should be terminated usingTimeout.isExpired(), or how much longer conversion should be allowed to run usingTimeout.getTime(),Timeout.getUnit().- Returns:
- the timeout to perform the conversion.
- Since:
- 7.0.1
 
 - 
checkTimeoutvoid checkTimeout() throws XhtmlTimeoutExceptionCheck the timeout and throw an XhtmlTimeoutException if the timeout is expired. Usetimeout()andTimeout.isExpired()to check the timeout without throwing an exception.- Throws:
- XhtmlTimeoutException- if the conversion has exceeded its time limit.
 
 - 
isDiffOrEmailboolean isDiffOrEmail() Check if the current context isConversionContextOutputType.DIFForConversionContextOutputType.EMAIL- Returns:
- true if the context is DIFF or EMAIL
 
 - 
addMarshallerMetricsConsumervoid addMarshallerMetricsConsumer(MarshallerMetricsConsumer consumer) Adds a consumer ofMarshallerMetricsthat 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.
 - 
removeMarshallerMetricsConsumerboolean removeMarshallerMetricsConsumer(MarshallerMetricsConsumer consumer) Removes a consumer ofMarshallerMetricsthat is associated with the current render.- Returns:
- true if the specified consumer was removed.
 
 - 
getMarshallerMetricsConsumersSet<MarshallerMetricsConsumer> getMarshallerMetricsConsumers() Returns the consumers ofMarshallerMetricsthat 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.- Returns:
- the list of consumers
 
 
- 
 
-