Package com.atlassian.adf.model.node
Class BodiedExtension
- java.lang.Object
-
- com.atlassian.adf.model.node.AbstractNode<C>
-
- com.atlassian.adf.model.node.AbstractContentNode<C,N>
-
- com.atlassian.adf.model.node.AbstractMarkedContentNode<BodiedExtension,NonNestableBlockContent,BodiedExtensionMark>
-
- com.atlassian.adf.model.node.BodiedExtension
-
- All Implemented Interfaces:
Element,Node,ContentNode<BodiedExtension,NonNestableBlockContent>,DocContent,ExtensionNode<BodiedExtension,BodiedExtensionMark>,LayoutColumnContent,Marked<BodiedExtension,BodiedExtensionMark>
@Documentation(state=UNDOCUMENTED, date="2023-07-26") public class BodiedExtension extends AbstractMarkedContentNode<BodiedExtension,NonNestableBlockContent,BodiedExtensionMark> implements ExtensionNode<BodiedExtension,BodiedExtensionMark>, DocContent, LayoutColumnContent
Extensions provide hook points for ecosystem add-ons to integrate with how ADF content is rendered. ThebodiedExtensionnode type is used in contexts that only permit "block" content, such as at the top level (indocitself) or in thelayoutColumnnodes that are permitted in Confluence.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.atlassian.adf.model.node.AbstractNode
AbstractNode.ToStringHelper
-
-
Field Summary
-
Fields inherited from class com.atlassian.adf.model.node.AbstractMarkedContentNode
marks
-
Fields inherited from class com.atlassian.adf.model.node.AbstractContentNode
content
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendMarkedContentNodeFields(AbstractNode.ToStringHelper buf)voidappendPlainText(StringBuilder sb)Renders this node as plain-text suitable for viewing by end users.static ExtensionSettings.Partial.NeedsExtensionKey<BodiedExtension>bodiedExtension()static BodiedExtensionbodiedExtension(String extensionKey, String extensionType)Class<NonNestableBlockContent>contentClass()ReturnsClass<N>, the class representing the type of items held by this node.BodiedExtensioncopy()Returns a deep copy of this element, including copies of any nodes or marks that it contains.StringelementType()Thetypevalue that identifies this element, such as"paragraph"or"strong".StringextensionKey()BodiedExtensionextensionKey(String extensionKey)Replace the extension's key.StringextensionType()BodiedExtensionextensionType(String extensionType)Replace the extension's type.Optional<ExtensionSettings.Layout>layout()BodiedExtensionlayout(ExtensionSettings.Layout layout)BodiedExtensionlayout(String layout)Optional<String>localId()BodiedExtensionlocalId(String localId)Replaces (or clears) the extension's local ID.Class<BodiedExtensionMark>markClass()Returns the type of marks that may be applied to this node.protected booleanmarkedContentNodeEquals(BodiedExtension other)protected intmarkedContentNodeHashCode()protected voidmarkedContentNodeValidate()Optional<Map<String,?>>parameters()BodiedExtensionparameters(Map<String,?> parameters)Replaces (or clears) the extension's parameter map.Optional<String>text()BodiedExtensiontext(String text)Replaces (or clears) the extension's text value.Map<String,?>toMap()Transforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.protected voidvalidateContentNodeForAppend(NonNestableBlockContent node)Called on each content node before it is added to validate that the node can be accepted.-
Methods inherited from class com.atlassian.adf.model.node.AbstractMarkedContentNode
appendContentNodeFields, contentNodeEquals, contentNodeHashCode, contentNodeValidate, createMarkHolder, mark, mark, marks, marks, markTypes, parseMarks, unsupportedMarkFactory
-
Methods inherited from class com.atlassian.adf.model.node.AbstractContentNode
addContent, addContentIfPresent, allNodes, appendNodeFields, appendPlainTextContentJoinedWith, appendPlainTextInlineContent, clear, content, content, content, content, content, contentFieldMaps, isEmpty, nodeEquals, nodeHashCode, parseContentItem, parseContentItems, parseOptionalContent, parseRequiredContent, parseRequiredContentAllowEmpty, removeIf, replaceContent, requireNotEmpty, transformContent, transformDescendants, trim, validate, validateContentItems
-
Methods inherited from class com.atlassian.adf.model.node.AbstractNode
doubleEq, doubleHash, equals, hashCode, isSupported, mapWithType, numberEq, numberHash, self, toPlainText, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.atlassian.adf.model.node.type.ContentNode
allNodes, allNodesOfType, allNodesOfTypeAsList, clear, content, content, content, content, content, isEmpty, removeIf, replaceContent, transformContent, transformDescendants
-
Methods inherited from interface com.atlassian.adf.model.Element
isSupported, validate
-
Methods inherited from interface com.atlassian.adf.model.node.type.Marked
mark, mark, marks, marks, markTypes
-
Methods inherited from interface com.atlassian.adf.model.node.Node
toPlainText
-
-
-
-
Method Detail
-
bodiedExtension
@CheckReturnValue public static ExtensionSettings.Partial.NeedsExtensionKey<BodiedExtension> bodiedExtension()
-
bodiedExtension
public static BodiedExtension bodiedExtension(String extensionKey, String extensionType)
-
contentClass
public Class<NonNestableBlockContent> contentClass()
Description copied from interface:ContentNodeReturnsClass<N>, the class representing the type of items held by this node.- Specified by:
contentClassin interfaceContentNode<BodiedExtension,NonNestableBlockContent>
-
copy
public BodiedExtension copy()
Description copied from interface:ElementReturns a deep copy of this element, including copies of any nodes or marks that it contains. The copy will not necessarily be in exactly the same state as the original in some cases. For example, atextnode that is used inside acodeBlockwill have the ability to use marks on it disabled, but a copy made of the text node using this method will not similarly disallow marks unless it is also added to a content node with those same restrictions.Implementations notes:
- Implementations should narrow the return type.
- Implementations should
return thisif the element is immutable. The@Immutableannotation should be used on the class to offer additional confirmation of this intent. - Implementations should
return parse(toMap())if they have state. - While there may be cases where it is worthwhile to do something more efficient than
the conversion to a map and back, this is discouraged because it would add yet another
fragile piece of code that breaks when new data is added to the node. The
parseandtoMapmethods already have to be updated in these circumstances, so it makes sense to take advantage of that.
- Specified by:
copyin interfaceContentNode<BodiedExtension,NonNestableBlockContent>- Specified by:
copyin interfaceElement- Specified by:
copyin interfaceExtensionNode<BodiedExtension,BodiedExtensionMark>- Specified by:
copyin interfaceMarked<BodiedExtension,BodiedExtensionMark>- Specified by:
copyin interfaceNode- Returns:
- a copy of this element, or
thisif the element is immutable anyway
-
elementType
public String elementType()
Description copied from interface:ElementThetypevalue that identifies this element, such as"paragraph"or"strong".- Specified by:
elementTypein interfaceElement
-
toMap
public Map<String,?> toMap()
Description copied from interface:ElementTransforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.
-
validateContentNodeForAppend
protected void validateContentNodeForAppend(NonNestableBlockContent node)
Description copied from class:AbstractContentNodeCalled on each content node before it is added to validate that the node can be accepted.- Overrides:
validateContentNodeForAppendin classAbstractContentNode<BodiedExtension,NonNestableBlockContent>- Parameters:
node- the node that is about to be added
-
markClass
public Class<BodiedExtensionMark> markClass()
Description copied from interface:MarkedReturns the type of marks that may be applied to this node.- Specified by:
markClassin interfaceMarked<BodiedExtension,BodiedExtensionMark>- Specified by:
markClassin classAbstractMarkedContentNode<BodiedExtension,NonNestableBlockContent,BodiedExtensionMark>- Returns:
- the type of marks that may be applied to this node, which is the concrete type for the generic
type
<M>on this interface.
-
markedContentNodeValidate
protected void markedContentNodeValidate()
- Overrides:
markedContentNodeValidatein classAbstractMarkedContentNode<BodiedExtension,NonNestableBlockContent,BodiedExtensionMark>
-
markedContentNodeHashCode
protected int markedContentNodeHashCode()
- Overrides:
markedContentNodeHashCodein classAbstractMarkedContentNode<BodiedExtension,NonNestableBlockContent,BodiedExtensionMark>
-
markedContentNodeEquals
protected boolean markedContentNodeEquals(BodiedExtension other)
- Overrides:
markedContentNodeEqualsin classAbstractMarkedContentNode<BodiedExtension,NonNestableBlockContent,BodiedExtensionMark>
-
appendMarkedContentNodeFields
protected void appendMarkedContentNodeFields(AbstractNode.ToStringHelper buf)
-
extensionKey
public String extensionKey()
- Specified by:
extensionKeyin interfaceExtensionNode<BodiedExtension,BodiedExtensionMark>- Returns:
- the extension's key
-
extensionKey
public BodiedExtension extensionKey(String extensionKey)
Description copied from interface:ExtensionNodeReplace the extension's key.- Specified by:
extensionKeyin interfaceExtensionNode<BodiedExtension,BodiedExtensionMark>- Parameters:
extensionKey- the new extension key value; must not be empty- Returns:
this
-
extensionType
public String extensionType()
- Specified by:
extensionTypein interfaceExtensionNode<BodiedExtension,BodiedExtensionMark>- Returns:
- the extension's type
-
extensionType
public BodiedExtension extensionType(String extensionType)
Description copied from interface:ExtensionNodeReplace the extension's type.- Specified by:
extensionTypein interfaceExtensionNode<BodiedExtension,BodiedExtensionMark>- Parameters:
extensionType- the new extension type value; must not be empty- Returns:
this
-
localId
public BodiedExtension localId(@Nullable String localId)
Description copied from interface:ExtensionNodeReplaces (or clears) the extension's local ID.- Specified by:
localIdin interfaceExtensionNode<BodiedExtension,BodiedExtensionMark>- Parameters:
localId- the extension's new local ID, ornullto clear it.- Returns:
this
-
localId
public Optional<String> localId()
- Specified by:
localIdin interfaceExtensionNode<BodiedExtension,BodiedExtensionMark>- Returns:
- the extension's local ID, or
emptyif it has not been set
-
text
public BodiedExtension text(@Nullable String text)
Description copied from interface:ExtensionNodeReplaces (or clears) the extension's text value.- Specified by:
textin interfaceExtensionNode<BodiedExtension,BodiedExtensionMark>- Parameters:
text- the extension's new text value, ornullto clear it.- Returns:
this
-
text
public Optional<String> text()
- Specified by:
textin interfaceExtensionNode<BodiedExtension,BodiedExtensionMark>- Returns:
- the extension's text value, or
emptyif it has not been set
-
parameters
public BodiedExtension parameters(@Nullable Map<String,?> parameters)
Description copied from interface:ExtensionNodeReplaces (or clears) the extension's parameter map.- Specified by:
parametersin interfaceExtensionNode<BodiedExtension,BodiedExtensionMark>- Parameters:
parameters- the extension's new parameter map, ornullto discard any existing one.- Returns:
this
-
parameters
public Optional<Map<String,?>> parameters()
- Specified by:
parametersin interfaceExtensionNode<BodiedExtension,BodiedExtensionMark>- Returns:
- the extension's parameter map, or
emptyif it has not been set
-
layout
public BodiedExtension layout(String layout)
-
layout
public BodiedExtension layout(ExtensionSettings.Layout layout)
-
layout
public Optional<ExtensionSettings.Layout> layout()
-
appendPlainText
public void appendPlainText(StringBuilder sb)
Description copied from interface:NodeRenders this node as plain-text suitable for viewing by end users. This is equivalent to callingNode.toPlainText()and appending the result to the given buffer, except that it may be slightly more efficient, since it will write directly to the existing buffer instead of using a temporary buffer and having to make a copy of the result.- Specified by:
appendPlainTextin interfaceNode- Overrides:
appendPlainTextin classAbstractContentNode<BodiedExtension,NonNestableBlockContent>- Parameters:
sb- where to write the result
-
-