Package com.atlassian.adf.model.mark
Class SubSup
- java.lang.Object
-
- com.atlassian.adf.model.mark.SubSup
-
- All Implemented Interfaces:
Element,Mark,FormattedTextMark,TextMark
@Documentation(state=REVIEWED, date="2023-07-26") @Immutable public class SubSup extends Object implements FormattedTextMark
Thesubsupmark sets superscript or subscript styling. This mark applies toTextnodes and can only be combined with otherformatted-textmarks.Example
Java
p(text("Hello "),text("world").sup(),text("!") );ADF
{ "type": "paragraph", "content": [ { "type": "text", "text": "Hello " }, { "type": "text", "text": "world", "marks": [ { "type": "subsup", "attrs": { "type": "sup" } } ] }, { "type": "text", "text": "!" } ] }Result
Hello world!
- See Also:
- Mark - subsup
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSubSup.Type-
Nested classes/interfaces inherited from interface com.atlassian.adf.model.Element
Element.Key
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SubSupcopy()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".booleanisSub()booleanisSup()booleanisSupported()Indicates whether this element is fully supported by this library.protected FieldMapmapWithType()static SubSupsub()static Textsub(Text text)Convenience method for applying asubmark to an existingtextnode.static Textsub(String text)Convenience method for constructing atextnode with asubmark.static SubSupsup()static Textsup(Text text)Convenience method for applying asupmark to an existingtextnode.static Textsup(String text)Convenience method for constructing atextnode with asupmark.Map<String,?>toMap()Transforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.StringtoString()SubSup.Typetype()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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.atlassian.adf.model.Element
isSupported, validate
-
-
-
-
Method Detail
-
sub
public static SubSup sub()
- Returns:
- a
subsupmark for subscript text
-
sub
public static Text sub(String text)
Convenience method for constructing atextnode with asubmark.- Parameters:
text- the text to mark- Returns:
- the resulting marked text node
-
sub
public static Text sub(Text text)
Convenience method for applying asubmark to an existingtextnode.- Parameters:
text- the text to mark- Returns:
- the resulting marked text node
- Throws:
AdfException- if it isn't possible to apply that mark to the existingtextnode
-
sup
public static SubSup sup()
- Returns:
- a
subsupmark for superscript text
-
sup
public static Text sup(String text)
Convenience method for constructing atextnode with asupmark.- Parameters:
text- the text to mark- Returns:
- the resulting marked text node
-
sup
public static Text sup(Text text)
Convenience method for applying asupmark to an existingtextnode.- Parameters:
text- the text to mark- Returns:
- the resulting marked text node
- Throws:
AdfException- if it isn't possible to apply that mark to the existingtextnode
-
copy
public SubSup 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.
-
isSub
public boolean isSub()
-
isSup
public boolean isSup()
-
type
public SubSup.Type type()
-
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
-
-