Package com.atlassian.adf.model.node
Class MediaGroup
- java.lang.Object
-
- com.atlassian.adf.model.node.AbstractNode<C>
-
- com.atlassian.adf.model.node.AbstractContentNode<MediaGroup,Media>
-
- com.atlassian.adf.model.node.MediaGroup
-
- All Implemented Interfaces:
Element,Node,ContentNode<MediaGroup,Media>,DocContent,LayoutColumnContent,NestedExpandContent,NonNestableBlockContent,TableCellContent
@Documentation(state=REVIEWED, date="2023-07-26") public class MediaGroup extends AbstractContentNode<MediaGroup,Media> implements DocContent, LayoutColumnContent, NestedExpandContent, NonNestableBlockContent, TableCellContent
A container for several media items. Compare tomediaSingle, which is intended for the display of a singlemediaitem in full.Example
Java
mediaGroup( Media.media() .file() .id("6e7c7f2c-dd7a-499c-bceb-6f32bfbf30b5") .collection("ae730abd-a389-46a7-90eb-c03e75a45bf6"), Media.media() .file() .id("16a23024-6762-4d30-a6ec-298768507fa7") .collection("ae730abd-a389-46a7-90eb-c03e75a45bf6") );ADF
{ "type": "mediaGroup", "content": [ { "type": "media", "attrs": { "type": "file", "id": "6e7c7f2c-dd7a-499c-bceb-6f32bfbf30b5", "collection": "ae730abd-a389-46a7-90eb-c03e75a45bf6" } }, { "type": "media", "attrs": { "type": "file", "id": "16a23024-6762-4d30-a6ec-298768507fa7", "collection": "ae730abd-a389-46a7-90eb-c03e75a45bf6" } } ] }- See Also:
- Node - mediaGroup
-
-
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.AbstractContentNode
content
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendPlainText(StringBuilder sb)Renders this node as plain-text suitable for viewing by end users.Class<Media>contentClass()ReturnsClass<N>, the class representing the type of items held by this node.MediaGroupcopy()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 MediaGroupmediaGroup()static MediaGroupmediaGroup(Media content)static MediaGroupmediaGroup(Media... content)static MediaGroupmediaGroup(Iterable<? extends Media> content)static MediaGroupmediaGroup(Stream<? extends Media> content)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.AbstractContentNode
addContent, addContentIfPresent, allNodes, appendContentNodeFields, appendNodeFields, appendPlainTextContentJoinedWith, appendPlainTextInlineContent, clear, content, content, content, content, content, contentFieldMaps, contentNodeEquals, contentNodeHashCode, contentNodeValidate, isEmpty, nodeEquals, nodeHashCode, parseContentItem, parseContentItems, parseOptionalContent, parseRequiredContent, parseRequiredContentAllowEmpty, removeIf, replaceContent, requireNotEmpty, transformContent, transformDescendants, trim, validate, validateContentItems, validateContentNodeForAppend
-
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
allNodesOfType, allNodesOfTypeAsList
-
Methods inherited from interface com.atlassian.adf.model.Element
isSupported, validate
-
Methods inherited from interface com.atlassian.adf.model.node.Node
toPlainText
-
-
-
-
Method Detail
-
mediaGroup
public static MediaGroup mediaGroup()
- Returns:
- a new, empty media group. At least one
medianode must be added to make it valid.
-
mediaGroup
public static MediaGroup mediaGroup(Media content)
- Returns:
- a new media group with the given content
-
mediaGroup
public static MediaGroup mediaGroup(Media... content)
- Returns:
- a new media group with the given content
-
mediaGroup
public static MediaGroup mediaGroup(Iterable<? extends Media> content)
- Returns:
- a new media group with the given content
-
mediaGroup
public static MediaGroup mediaGroup(Stream<? extends Media> content)
- Returns:
- a new media group with the given content
-
contentClass
public Class<Media> contentClass()
Description copied from interface:ContentNodeReturnsClass<N>, the class representing the type of items held by this node.- Specified by:
contentClassin interfaceContentNode<MediaGroup,Media>
-
copy
public MediaGroup 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<MediaGroup,Media>- Specified by:
copyin interfaceElement- 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.
-
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<MediaGroup,Media>- Parameters:
sb- where to write the result
-
-