Package com.atlassian.adf.model.node
Class MediaInline
- java.lang.Object
-
- com.atlassian.adf.model.node.AbstractNode<N>
-
- com.atlassian.adf.model.node.AbstractMarkedNode<MediaInline,MediaInlineMark>
-
- com.atlassian.adf.model.node.MediaInline
-
- All Implemented Interfaces:
Element,Node,InlineContent,InternalMediaNode,Marked<MediaInline,MediaInlineMark>
@Documentation(state=UNDOCUMENTED, date="2023-07-26") public class MediaInline extends AbstractMarkedNode<MediaInline,MediaInlineMark> implements InlineContent, InternalMediaNode
ThemediaInlinenode type works just likefileandlinktypes ofmedianodes, except that instead of being placed inside themediaGroupandmediaSingleblock nodes, they are used in places thatinline contentis permitted, such as within aparagraph.Note that while the media
collectionis being phased out, it is currently still required by the schema. This node allows the caller to fail to set it or set it tonull, but will substitute the empty string""instead, for the time being.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMediaInline.MediaTypestatic interfaceMediaInline.PartialTypes that represent a partially constructedmediaInline.-
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 Deprecated Methods Modifier and Type Method Description Optional<String>alt()MediaInlinealt(String alt)protected voidappendMarkedNodeFields(AbstractNode.ToStringHelper buf)Stringcollection()MediaInlinecollection(String collection)MediaInlinecopy()Returns a deep copy of this element, including copies of any nodes or marks that it contains.Optional<Map<String,?>>data()MediaInlinedata(Map<String,?> data)StringelementType()Thetypevalue that identifies this element, such as"paragraph"or"strong".MediaInlinefile()Optional<Number>height()Returns the mediaInline node's display height, if set.MediaInlineheight(Number height)Sets the height of the media.Stringid()Returns the mediaInline node's ID.MediaInlineid(String id)booleanisFile()booleanisLink()Deprecated.Most of the support forlinkmedia no longer functions in the editor code base, so clients are unlikely to encounter it in the wild and should not use it in new ADF.MediaInlinelink()MediaInlinelink(Link link)MediaInlinelink(String href)Optional<Link>linkMark()MediaInlinelinkMark(Link link)MediaInlinelinkMark(String href)MediaInlinelinkMark(URL url)Class<MediaInlineMark>markClass()Returns the type of marks that may be applied to this node.protected booleanmarkedNodeEquals(MediaInline other)protected intmarkedNodeHashCode()static MediaInline.Partial.NeedsIdmediaInline()static MediaInlinemediaInline(String id)static MediaInlinemediaInline(String id, MediaInline.MediaType mediaType, String collection)Creates a newmediaInlinenode with the given media ID, media type, and collection ID.static MediaInlinemediaInline(String id, String collection)Creates a newmediaInlinenode with the given media ID and collection ID.static MediaInline.Partial.NeedsIdmediaInlineFile()static MediaInlinemediaInlineFile(String id)static MediaInline.Partial.NeedsIdmediaInlineLink()Deprecated.Most of the support forlinkmedia no longer functions in the editor code base, so clients are unlikely to encounter it in the wild and should not use it in new ADF.static MediaInlinemediaInlineLink(String id)Deprecated.Most of the support forlinkmedia no longer functions in the editor code base, so clients are unlikely to encounter it in the wild and should not use it in new ADF.Optional<MediaInline.MediaType>mediaType()MediaInlinemediaType(MediaInline.MediaType mediaType)MediaInlinemediaType(String mediaType)Optional<String>occurrenceKey()Returns the mediaInline node's occurrence key, if set.MediaInlineoccurrenceKey(String occurrenceKey)Sets the occurrence key for this mediaInline item.MediaInlinesize(Number width, Number height)Sets the width and height of the media.Map<String,?>toMap()Transforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.Optional<Number>width()Returns the mediaInline node's display width, if set.MediaInlinewidth(Number width)Sets the width of the media.-
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
appendPlainText, 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.Node
appendPlainText, toPlainText
-
-
-
-
Method Detail
-
link
public MediaInline link(@Nullable Link link)
-
link
public MediaInline link(@Nullable String href)
-
data
public MediaInline data(@Nullable Map<String,?> data)
-
id
public String id()
Returns the mediaInline node's ID.- Specified by:
idin interfaceInternalMediaNode- Returns:
- the mediaInline node's ID.
-
id
public MediaInline id(String id)
- Specified by:
idin interfaceInternalMediaNode
-
collection
public String collection()
- Specified by:
collectionin interfaceInternalMediaNode- Returns:
- the mediaInline node's collection ID.
-
collection
public MediaInline collection(@Nullable String collection)
- Specified by:
collectionin interfaceInternalMediaNode
-
occurrenceKey
public Optional<String> occurrenceKey()
Returns the mediaInline node's occurrence key, if set.- Specified by:
occurrenceKeyin interfaceInternalMediaNode- Returns:
- the mediaInline node's occurrence key, or
empty()if not set.
-
occurrenceKey
public MediaInline occurrenceKey(@Nullable String occurrenceKey)
Sets the occurrence key for this mediaInline item. Although this attribute is optional, it must be set to enable deletion of files from a collection.- Specified by:
occurrenceKeyin interfaceInternalMediaNode- Parameters:
occurrenceKey- the occurrence key value- Returns:
this
-
mediaInline
public static MediaInline.Partial.NeedsId mediaInline()
-
mediaInline
public static MediaInline mediaInline(String id)
-
mediaInlineFile
public static MediaInline.Partial.NeedsId mediaInlineFile()
-
mediaInlineFile
public static MediaInline mediaInlineFile(String id)
-
mediaInlineLink
@Deprecated public static MediaInline.Partial.NeedsId mediaInlineLink()
Deprecated.Most of the support forlinkmedia no longer functions in the editor code base, so clients are unlikely to encounter it in the wild and should not use it in new ADF.
-
mediaInlineLink
@Deprecated public static MediaInline mediaInlineLink(String id)
Deprecated.Most of the support forlinkmedia no longer functions in the editor code base, so clients are unlikely to encounter it in the wild and should not use it in new ADF.
-
file
public MediaInline file()
-
link
public MediaInline link()
-
isFile
public boolean isFile()
- Specified by:
isFilein interfaceInternalMediaNode
-
isLink
@Deprecated public boolean isLink()
Deprecated.Most of the support forlinkmedia no longer functions in the editor code base, so clients are unlikely to encounter it in the wild and should not use it in new ADF.- Specified by:
isLinkin interfaceInternalMediaNode
-
mediaType
public MediaInline mediaType(@Nullable String mediaType)
-
mediaType
public MediaInline mediaType(@Nullable MediaInline.MediaType mediaType)
-
mediaType
public Optional<MediaInline.MediaType> mediaType()
-
width
public Optional<Number> width()
Returns the mediaInline node's display width, if set.- Returns:
- the mediaInline node's display width, or
empty()if not set.
-
width
public MediaInline width(Number width)
Sets the width of the media.- Parameters:
width- the display width of the mediaInline item, in pixels; must be positive- Returns:
this
-
height
public Optional<Number> height()
Returns the mediaInline node's display height, if set.- Returns:
- the mediaInline node's display height, or
empty()if not set.
-
height
public MediaInline height(Number height)
Sets the height of the media.- Parameters:
height- the display height of the mediaInline item, in pixels; must be positive- Returns:
this
-
size
public MediaInline size(Number width, Number height)
Sets the width and height of the media.This convenience method is exactly equivalent to calling
.width(width).height(height)- Parameters:
width- as forwidth(Number)height- as forheight(Number)- Returns:
this
-
alt
public MediaInline alt(@Nullable String alt)
-
linkMark
public MediaInline linkMark(@Nullable Link link)
-
linkMark
public MediaInline linkMark(@Nullable URL url)
-
linkMark
public MediaInline linkMark(@Nullable String href)
-
mediaInline
public static MediaInline mediaInline(String id, @Nullable String collection)
Creates a newmediaInlinenode with the given media ID and collection ID.- Parameters:
id- the Media Services ID used for querying the media services API to retrieve metadata, such as the filename. Consumers of the document should always fetch fresh metadata using the Media API rather than cache it locally.collection- the MediaInline Services Collection name for the media- Returns:
- the new
medianode
-
mediaInline
public static MediaInline mediaInline(String id, @Nullable MediaInline.MediaType mediaType, @Nullable String collection)
Creates a newmediaInlinenode with the given media ID, media type, and collection ID.- Parameters:
id- the Media Services ID used for querying the media services API to retrieve metadata, such as the filename. Consumers of the document should always fetch fresh metadata using the Media API rather than cache it locally.mediaType- the media type to assigncollection- the MediaInline Services Collection name for the media- Returns:
- the new
medianode
-
copy
public MediaInline 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 interfaceMarked<MediaInline,MediaInlineMark>- Specified by:
copyin interfaceNode- Specified by:
copyin classAbstractMarkedNode<MediaInline,MediaInlineMark>- 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
-
markClass
public Class<MediaInlineMark> markClass()
Description copied from interface:MarkedReturns the type of marks that may be applied to this node.- Specified by:
markClassin interfaceMarked<MediaInline,MediaInlineMark>- Specified by:
markClassin classAbstractMarkedNode<MediaInline,MediaInlineMark>- 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.
-
markedNodeEquals
protected boolean markedNodeEquals(MediaInline other)
- Overrides:
markedNodeEqualsin classAbstractMarkedNode<MediaInline,MediaInlineMark>
-
markedNodeHashCode
protected int markedNodeHashCode()
- Overrides:
markedNodeHashCodein classAbstractMarkedNode<MediaInline,MediaInlineMark>
-
appendMarkedNodeFields
protected void appendMarkedNodeFields(AbstractNode.ToStringHelper buf)
- Overrides:
appendMarkedNodeFieldsin classAbstractMarkedNode<MediaInline,MediaInlineMark>
-
-