Package com.atlassian.adf.model.mark
Class Annotation
- java.lang.Object
-
- com.atlassian.adf.model.mark.Annotation
-
- All Implemented Interfaces:
Element,Mark,CodeTextMark,FormattedTextMark,TextMark
@Immutable @Documentation(state=UNDOCUMENTED, date="2023-07-26") public class Annotation extends Object implements CodeTextMark, FormattedTextMark
The annotation mark shows the presence of an annotation or comment on a node. This mark applies totextnodes.Annotation marks are used in Confluence to provide links to inline comments. It does not seem to be used by any other products at this time.
Example
Java
p(text("hello "),text("there") .mark(inlineComment("123456")) );ADF
{ "type": "paragraph", "content": [ { "type": "text", "text": "hello " }, { "type": "text", "text": "there", "marks": [ { "type": "annotation", "attrs": { "id": "123456", "annotationType": "inlineComment" } } ] } ] }Result
hello thereNote: This example output is not using AtlasKit to render the link, so while it gives a vague impression of what an annotation is, it does not faithfully reproduce the actual presentation in Atlassian products.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAnnotation.AnnotationType-
Nested classes/interfaces inherited from interface com.atlassian.adf.model.Element
Element.Key
-
-
Constructor Summary
Constructors Constructor Description Annotation(String id, Annotation.AnnotationType annotationType)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Annotationannotation(String id, Annotation.AnnotationType annotationType)Annotation.AnnotationTypeannotationType()Annotationcopy()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".booleanequals(Object o)inthashCode()Stringid()static AnnotationinlineComment(String id)booleanisSupported()Indicates whether this element is fully supported by this library.protected FieldMapmapWithType()Map<String,?>toMap()Transforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.StringtoString()voidvalidate()Verifies that the node is well-formed (including the state of any descendents that it has).-
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
-
-
-
-
Constructor Detail
-
Annotation
public Annotation(String id, Annotation.AnnotationType annotationType)
-
-
Method Detail
-
annotation
public static Annotation annotation(String id, Annotation.AnnotationType annotationType)
-
copy
public Annotation 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 interfaceCodeTextMark- Specified by:
copyin interfaceElement- Specified by:
copyin interfaceFormattedTextMark- Specified by:
copyin interfaceMark- Specified by:
copyin interfaceTextMark- Returns:
- a copy of this element, or
thisif the element is immutable anyway
-
inlineComment
public static Annotation inlineComment(String id)
-
id
public String id()
-
annotationType
public Annotation.AnnotationType annotationType()
-
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.
-
toString
public String toString()
-
mapWithType
protected FieldMap mapWithType()
-
isSupported
public boolean isSupported()
Description copied from interface:ElementIndicates whether this element is fully supported by this library. This library includes a small amount of support for preserving new, unrecognized node types during a round trip. These are represented by immutable placeholder objects that returnfalsefor this value.- Specified by:
isSupportedin interfaceElement- Returns:
truefor fully supported elements;falsefor immutable placeholders
-
-