Class Emoji
- java.lang.Object
-
- com.atlassian.adf.model.node.AbstractNode<Emoji>
-
- com.atlassian.adf.model.node.Emoji
-
- All Implemented Interfaces:
Element,Node,CaptionContent,InlineContent
@Documentation(state=REVIEWED, date="2023-07-26") public class Emoji extends AbstractNode<Emoji> implements CaptionContent, InlineContent
An inline node that represents an emoji.There are three kinds of emoji:
- Standard — Unicode emoji
- Atlassian — Non-standard emoji introduced by Atlassian
- Site — Non-standard customer-defined emoji
Example: Unicode emoji
Java
emoji(":grinning:") .text("\uD83D\uDE00");ADF
{ "type": "emoji", "attrs": { "shortName": ":grinning:", "text": "😀" } }Example: Non-standard Atlassian emoji
Java
emoji(":awthanks:") .text("\uD83D\uDE00");ADF
{ "type": "emoji", "attrs": { "shortName": ":awthanks:", "id": "atlassian-awthanks", "text": ":awthanks:" } }Example: Non-standard customer emoji
Java
emoji(":thumbsup::skin-tone-2:") .id("1f44d") .text("\uD83D\uDC4D\uD83C\uDFFD");ADF
{ "type": "emoji", "attrs": { "shortName": ":thumbsup::skin-tone-2:", "id": "1f44d", "text": "👍🏽" } }- See Also:
- Node - emoji
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceEmoji.PartialTypes that represent a partially constructedemoji.static interfaceEmoji.Standard-
Nested classes/interfaces inherited from class com.atlassian.adf.model.node.AbstractNode
AbstractNode.ToStringHelper
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendNodeFields(AbstractNode.ToStringHelper buf)Allows nodes that have their own fields to augment thetoString()implementation with their own field values.voidappendPlainText(StringBuilder sb)Renders this node as plain-text suitable for viewing by end users.Emojicopy()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 Emoji.Partial.NeedsShortNameemoji()static Emojiemoji(String shortName)Optional<String>id()Returns the id of the emoji, if set.Emojiid(String id)Sets the internal identifier for the emoji.protected booleannodeEquals(Emoji 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.StringshortName()Returns the short name of the emoji.EmojishortName(String shortName)Optional<String>text()Returns the text of the emoji, if set.Emojitext(String text)Sets the text version of the emoji.Map<String,?>toMap()Transforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.voidvalidate()Verifies that the node is well-formed (including the state of any descendents that it has).-
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.Element
isSupported
-
Methods inherited from interface com.atlassian.adf.model.node.Node
toPlainText
-
-
-
-
Method Detail
-
emoji
public static Emoji.Partial.NeedsShortName emoji()
-
emoji
public static Emoji emoji(String shortName)
- Parameters:
shortName- the short name that identifies this emoji, such as:grinning:- Returns:
- a new emoji node with the given short name
-
shortName
public String shortName()
Returns the short name of the emoji.- Returns:
- the short name of the emoji.
-
id
public Optional<String> id()
Returns the id of the emoji, if set.- Returns:
- the id of the emoji, or
empty()if not set.
-
id
public Emoji id(String id)
Sets the internal identifier for the emoji.- Parameters:
id- an identifier for the emoji with a format that varies based on the emoji type. The is is not intended to have any user-facing meaning.- Returns:
this
-
text
public Optional<String> text()
Returns the text of the emoji, if set.- Returns:
- the text of the emoji, or
empty()if not set.
-
text
public Emoji text(String text)
Sets the text version of the emoji.- Parameters:
text- the text version of the emoji; if unset, the short name is used in its place- Returns:
this
-
copy
public Emoji 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.
-
nodeEquals
protected boolean nodeEquals(Emoji 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<Emoji>- 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<Emoji>- 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<Emoji>- Parameters:
buf- where the field values should be written- See Also:
AbstractNode.nodeHashCode(),AbstractNode.nodeEquals(AbstractNode)
-
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).
-
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 classAbstractNode<Emoji>- Parameters:
sb- where to write the result
-
-