Package com.atlassian.adf.model.node
Class Extension
- java.lang.Object
-
- com.atlassian.adf.model.node.AbstractNode<N>
-
- com.atlassian.adf.model.node.AbstractMarkedNode<Extension,ExtensionMark>
-
- com.atlassian.adf.model.node.Extension
-
- All Implemented Interfaces:
Element,Node,DocContent,ExtensionNode<Extension,ExtensionMark>,LayoutColumnContent,Marked<Extension,ExtensionMark>,NonNestableBlockContent,TableCellContent
@Documentation(state=UNDOCUMENTED, date="2023-07-26") public class Extension extends AbstractMarkedNode<Extension,ExtensionMark> implements ExtensionNode<Extension,ExtensionMark>, DocContent, LayoutColumnContent, NonNestableBlockContent, TableCellContent
Extensions provide hook points for ecosystem add-ons to integrate with how ADF content is rendered. LikebodiedExtensionnodes, the genericextensionnode type is used in contexts that only permit "block" content, such as the top-leveldocnode itself. However, there are some important differences:extensionnodes are leaves, butbodiedExtensionnodes wrap other contentextensionnodes can be used in places thatbodiedExtensioncan not, such as insidetableCell,tableHeader, orbodiedExtensionitself.
-
-
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.AbstractMarkedNode
marks
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendMarkedNodeFields(AbstractNode.ToStringHelper buf)voidappendPlainText(StringBuilder sb)Renders this node as plain-text suitable for viewing by end users.Extensioncopy()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".static ExtensionSettings.Partial.NeedsExtensionKey<Extension>extension()static Extensionextension(String extensionKey, String extensionType)StringextensionKey()ExtensionextensionKey(String extensionKey)Replace the extension's key.StringextensionType()ExtensionextensionType(String extensionType)Replace the extension's type.Optional<ExtensionSettings.Layout>layout()Extensionlayout(ExtensionSettings.Layout layout)Extensionlayout(String layout)Optional<String>localId()ExtensionlocalId(String localId)Replaces (or clears) the extension's local ID.Class<ExtensionMark>markClass()Returns the type of marks that may be applied to this node.protected booleanmarkedNodeEquals(Extension other)protected intmarkedNodeHashCode()Optional<Map<String,?>>parameters()Extensionparameters(Map<String,?> parameters)Replaces (or clears) the extension's parameter map.Optional<String>text()Extensiontext(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.-
Methods inherited from class com.atlassian.adf.model.node.AbstractMarkedNode
appendNodeFields, createMarkHolder, mark, mark, markedNodeValidate, marks, marks, markTypes, nodeEquals, nodeHashCode, parseMarks, unsupportedMarkFactory, validate
-
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.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
-
extension
@CheckReturnValue public static ExtensionSettings.Partial.NeedsExtensionKey<Extension> extension()
-
copy
public Extension 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 interfaceElement- Specified by:
copyin interfaceExtensionNode<Extension,ExtensionMark>- Specified by:
copyin interfaceMarked<Extension,ExtensionMark>- Specified by:
copyin interfaceNode- Specified by:
copyin classAbstractMarkedNode<Extension,ExtensionMark>- 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.
-
markClass
public Class<ExtensionMark> markClass()
Description copied from interface:MarkedReturns the type of marks that may be applied to this node.- Specified by:
markClassin interfaceMarked<Extension,ExtensionMark>- Specified by:
markClassin classAbstractMarkedNode<Extension,ExtensionMark>- 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.
-
markedNodeHashCode
protected int markedNodeHashCode()
- Overrides:
markedNodeHashCodein classAbstractMarkedNode<Extension,ExtensionMark>
-
markedNodeEquals
protected boolean markedNodeEquals(Extension other)
- Overrides:
markedNodeEqualsin classAbstractMarkedNode<Extension,ExtensionMark>
-
appendMarkedNodeFields
protected void appendMarkedNodeFields(AbstractNode.ToStringHelper buf)
- Overrides:
appendMarkedNodeFieldsin classAbstractMarkedNode<Extension,ExtensionMark>
-
extensionKey
public String extensionKey()
- Specified by:
extensionKeyin interfaceExtensionNode<Extension,ExtensionMark>- Returns:
- the extension's key
-
extensionKey
public Extension extensionKey(String extensionKey)
Description copied from interface:ExtensionNodeReplace the extension's key.- Specified by:
extensionKeyin interfaceExtensionNode<Extension,ExtensionMark>- Parameters:
extensionKey- the new extension key value; must not be empty- Returns:
this
-
extensionType
public String extensionType()
- Specified by:
extensionTypein interfaceExtensionNode<Extension,ExtensionMark>- Returns:
- the extension's type
-
extensionType
public Extension extensionType(String extensionType)
Description copied from interface:ExtensionNodeReplace the extension's type.- Specified by:
extensionTypein interfaceExtensionNode<Extension,ExtensionMark>- Parameters:
extensionType- the new extension type value; must not be empty- Returns:
this
-
localId
public Extension localId(@Nullable String localId)
Description copied from interface:ExtensionNodeReplaces (or clears) the extension's local ID.- Specified by:
localIdin interfaceExtensionNode<Extension,ExtensionMark>- Parameters:
localId- the extension's new local ID, ornullto clear it.- Returns:
this
-
localId
public Optional<String> localId()
- Specified by:
localIdin interfaceExtensionNode<Extension,ExtensionMark>- Returns:
- the extension's local ID, or
emptyif it has not been set
-
text
public Extension text(@Nullable String text)
Description copied from interface:ExtensionNodeReplaces (or clears) the extension's text value.- Specified by:
textin interfaceExtensionNode<Extension,ExtensionMark>- Parameters:
text- the extension's new text value, ornullto clear it.- Returns:
this
-
text
public Optional<String> text()
- Specified by:
textin interfaceExtensionNode<Extension,ExtensionMark>- Returns:
- the extension's text value, or
emptyif it has not been set
-
parameters
public Extension parameters(@Nullable Map<String,?> parameters)
Description copied from interface:ExtensionNodeReplaces (or clears) the extension's parameter map.- Specified by:
parametersin interfaceExtensionNode<Extension,ExtensionMark>- 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<Extension,ExtensionMark>- Returns:
- the extension's parameter map, or
emptyif it has not been set
-
layout
public Extension layout(@Nullable 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 classAbstractNode<Extension>- Parameters:
sb- where to write the result
-
-