Class Media.AbstractMedia<N extends Media.AbstractMedia<N>>
- java.lang.Object
-
- com.atlassian.adf.model.node.AbstractNode<N>
-
- com.atlassian.adf.model.node.Media.AbstractMedia<N>
-
- All Implemented Interfaces:
Element,Media,Node,Marked<Media,MediaMark>,Fold3<Media.FileMedia,Media.LinkMedia,Media.ExternalMedia>
- Direct Known Subclasses:
Media.ExternalMedia,Media.FileOrLinkMedia
- Enclosing interface:
- Media
public abstract static class Media.AbstractMedia<N extends Media.AbstractMedia<N>> extends AbstractNode<N> implements Media
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.atlassian.adf.model.node.AbstractNode
AbstractNode.ToStringHelper
-
Nested classes/interfaces inherited from interface com.atlassian.adf.model.node.Media
Media.AbstractMedia<N extends Media.AbstractMedia<N>>, Media.ExternalMedia, Media.FileMedia, Media.FileOrLinkMedia<T extends Media.FileOrLinkMedia<T>>, Media.LinkMedia, Media.MediaType, Media.Partial
-
-
Constructor Summary
Constructors Constructor Description AbstractMedia()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaccept(Consumer<? super Media.FileMedia> ifFile, Consumer<? super Media.LinkMedia> ifLink, Consumer<? super Media.ExternalMedia> ifExternal)protected voidaddCommonAttrs(FieldMap attrs)Optional<String>alt()Nalt(String alt)protected abstract voidappendMediaFields(AbstractNode.ToStringHelper buf)protected voidappendNodeFields(AbstractNode.ToStringHelper buf)Allows nodes that have their own fields to augment thetoString()implementation with their own field values.Optional<Border>border()Nborder(int size, String color)Nborder(Border border)Nborder(String color)StringelementType()Thetypevalue that identifies this element, such as"paragraph"or"strong".Optional<Number>height()Returns the media node's display height, if set.Nheight(Number height)Sets the height of the media.voidifExternal(Consumer<? super Media.ExternalMedia> effect)voidifFile(Consumer<? super Media.FileMedia> effect)voidifLink(Consumer<? super Media.LinkMedia> effect)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.Nlink(Link link)Nlink(String href)Optional<Link>linkMark()NlinkMark(Link link)NlinkMark(String href)NlinkMark(URL url)Nmark(MediaMark mark)Adds the given mark to this marked node.Optional<MediaMark>mark(String type)Returns the existing mark of the given type, if it exists.Class<MediaMark>markClass()Returns the type of marks that may be applied to this node.Collection<MediaMark>marks()Returns a list of the marks currently assigned to this node.<T extends MediaMark>
Stream<? extends T>marks(Class<T> markClass)Returns a stream of the marks that are currently assigned to this node and match the given type.Set<String>markTypes()Returns a set of all themark typesthat have been assigned to this node.protected abstract booleanmediaEquals(N other)protected abstract intmediaHashCode()protected booleannodeEquals(N other)Allows nodes that have their own fields to augment theequalsimplementation with tests for their own field values.protected intnodeHashCode()Allows nodes that have their own fields to augment thehashCodeimplementation with a hash of their own field values.protected voidparseCommonAttrs(Map<String,?> map)Nsize(Number width, Number height)Sets the width and height of the media.voidvalidate()Verifies that the node is well-formed (including the state of any descendents that it has).Optional<Number>width()Returns the media node's display width, if set.Nwidth(Number width)Sets the width of the media.-
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, toMap
-
Methods inherited from interface com.atlassian.adf.model.node.Media
external, file, fold, isExternal, isFile, isLink, link, type
-
Methods inherited from interface com.atlassian.adf.model.node.Node
appendPlainText, toPlainText
-
-
-
-
Method Detail
-
markClass
public final Class<MediaMark> markClass()
Description copied from interface:MarkedReturns the type of marks that may be applied to this node.
-
mark
public N mark(MediaMark mark)
Description copied from interface:MarkedAdds the given mark to this marked node.
-
marks
public Collection<MediaMark> marks()
Description copied from interface:MarkedReturns a list of the marks currently assigned to this node.
-
markTypes
public Set<String> markTypes()
Description copied from interface:MarkedReturns a set of all themark typesthat have been assigned to this node.- Specified by:
markTypesin interfaceMarked<Media,MediaMark>- Returns:
- a set of all the
mark typesthat have been assigned to this node.
-
marks
public <T extends MediaMark> Stream<? extends T> marks(Class<T> markClass)
Description copied from interface:MarkedReturns a stream of the marks that are currently assigned to this node and match the given type.Since only one mark of each type is permitted to be assigned to a single node, the stream will not contain multiple elements when
markClassis a concrete mark class.
-
mark
public Optional<MediaMark> mark(String type)
Description copied from interface:MarkedReturns the existing mark of the given type, if it exists.
-
accept
public void accept(Consumer<? super Media.FileMedia> ifFile, Consumer<? super Media.LinkMedia> ifLink, Consumer<? super Media.ExternalMedia> ifExternal)
- Specified by:
acceptin interfaceFold3<Media.FileMedia,Media.LinkMedia,Media.ExternalMedia>
-
width
public Optional<Number> width()
Description copied from interface:MediaReturns the media node's display width, if set.
-
width
public N width(@Nullable Number width)
Description copied from interface:MediaSets the width of the media. Although this attribute is optional, it must be set for themediaitem in amediaSinglenode, or the media is not displayed.
-
height
public Optional<Number> height()
Description copied from interface:MediaReturns the media node's display height, if set.
-
height
public N height(@Nullable Number height)
Description copied from interface:MediaSets the height of the media. Although this attribute is optional, it must be set for themediaitem in amediaSinglenode, or the media is not displayed.
-
size
public N size(@Nullable Number width, @Nullable Number height)
Description copied from interface:MediaSets the width and height of the media.This convenience method is exactly equivalent to calling
.width(width).height(height)- Specified by:
sizein interfaceMedia- Parameters:
width- as forMedia.width(Number)height- as forMedia.height(Number)- Returns:
this
-
ifFile
public void ifFile(Consumer<? super Media.FileMedia> effect)
-
ifLink
@Deprecated public void ifLink(Consumer<? super Media.LinkMedia> effect)
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.
-
ifExternal
public void ifExternal(Consumer<? super Media.ExternalMedia> effect)
- Specified by:
ifExternalin interfaceMedia
-
elementType
public String elementType()
Description copied from interface:ElementThetypevalue that identifies this element, such as"paragraph"or"strong".- Specified by:
elementTypein interfaceElement
-
validate
public void validate()
Description copied from interface:ElementVerifies that the node is well-formed (including the state of any descendents that it has).
-
nodeEquals
protected final boolean nodeEquals(N other)
Description copied from class:AbstractNodeAllows nodes that have their own fields to augment theequalsimplementation with tests for their own field values.Implementations need not check for identity,
null, or a different node class; those are already covered by theAbstractNode.equals(Object)implementation that is expected to be this method's only consumer.Just as with the relationship between
hashCode,equals, andtoStringfor ordinary Java classes, subclasses ofAbstractNodeshould maintain consistent implementations ofnodeHashCode,nodeEquals, andappendNodeFields.- Overrides:
nodeEqualsin classAbstractNode<N extends Media.AbstractMedia<N>>- Returns:
trueif all additional field values that belong to a particular type of content node test as equal;falseif differences are found- See Also:
AbstractNode.nodeHashCode(),AbstractNode.appendNodeFields(ToStringHelper)
-
nodeHashCode
protected int nodeHashCode()
Description copied from class:AbstractNodeAllows nodes that have their own fields to augment thehashCodeimplementation with a hash of their own field values.Implementations need not include the node's class; that is already covered by the
AbstractNode.hashCode()implementation that is expected to be this method's only consumer.Just as with the relationship between
hashCode,equals, andtoStringfor ordinary Java classes, subclasses ofAbstractNodeshould maintain consistent implementations ofnodeHashCode,nodeEquals, andappendNodeFields.- Overrides:
nodeHashCodein classAbstractNode<N extends Media.AbstractMedia<N>>- Returns:
- the hash code of any additional field values that belong to a particular type of content node.
- See Also:
AbstractNode.nodeEquals(AbstractNode),AbstractNode.appendNodeFields(ToStringHelper)
-
appendNodeFields
protected void appendNodeFields(AbstractNode.ToStringHelper buf)
Description copied from class:AbstractNodeAllows nodes that have their own fields to augment thetoString()implementation with their own field values.Each field's value should be provided by calling
AbstractNode.ToStringHelper.appendField(String, Object). Thevaluemay benull, in which case the field is omitted, for brevity. It will handle array values gracefully, including arrays of primitive types.Just as with the relationship between
hashCode,equals, andtoStringfor ordinary Java classes, subclasses ofAbstractNodeshould maintain consistent implementations ofnodeHashCode,nodeEquals, andappendNodeFields.- Overrides:
appendNodeFieldsin classAbstractNode<N extends Media.AbstractMedia<N>>- Parameters:
buf- where the field values should be written- See Also:
AbstractNode.nodeHashCode(),AbstractNode.nodeEquals(AbstractNode)
-
mediaEquals
protected abstract boolean mediaEquals(N other)
-
mediaHashCode
protected abstract int mediaHashCode()
-
appendMediaFields
protected abstract void appendMediaFields(AbstractNode.ToStringHelper buf)
-
addCommonAttrs
protected void addCommonAttrs(FieldMap attrs)
-
-