Class Emoji

java.lang.Object
net.fellbaum.jemoji.Emoji
All Implemented Interfaces:
Comparable<Emoji>

public final class Emoji extends Object implements Comparable<Emoji>
Represents an emoji along with its properties such as Unicode representation, HTML codes, aliases, keywords, and grouping details.
  • Method Details

    • getEmojiCodePoints

      public int[] getEmojiCodePoints()
      Gets the pre-computed codepoint array of this emoji's string.
      Returns:
      The codepoint array of this emoji.
    • getEmoji

      public String getEmoji()
      Gets the emoji value 🙂.
      Returns:
      The emoji
    • getUnicode

      @Deprecated public String getUnicode()
      Deprecated.
      Use getUnicodeText() instead
      Gets the Unicode representation of the emoji as a string i.e. \\uD83D\\uDE42 instead of displaying the actual emoji 🙂.
      Returns:
      The Unicode representation of the emoji
    • getUnicodeText

      public String getUnicodeText()
      Gets the Unicode representation of the emoji as a string i.e. \\uD83D\\uDE42 instead of displaying the actual emoji 🙂.
      Returns:
      The Unicode representation of the emoji
    • getHtmlDecimalCode

      public String getHtmlDecimalCode()
      Gets the HTML decimal code for this emoji.
      Returns:
      The HTML decimal code for this emoji.
    • getHtmlHexadecimalCode

      public String getHtmlHexadecimalCode()
      Gets the HTML hexadecimal code for this emoji.
      Returns:
      The HTML hexadecimal code for this emoji.
    • getVariations

      public List<Emoji> getVariations()
      Gets variations of this emoji with different Fitzpatrick or HairStyle modifiers if there are any. The returned list does not include this emoji itself.
      Returns:
      Variations of this emoji with different Fitzpatrick or HairStyle modifiers, if there are any.
    • getURLEncoded

      public String getURLEncoded()
      Gets the URL encoded emoji.
      Returns:
      The URL encoded emoji
    • getDiscordAliases

      public List<String> getDiscordAliases()
      Gets the Discord aliases for this emoji. If possible, do not use the :name::skin-tone-1: variants as they might not produce the emoji you want.
      Returns:
      The Discord aliases for this emoji.
    • getGithubAliases

      public List<String> getGithubAliases()
      Gets the GitHub aliases for this emoji.
      Returns:
      The GitHub aliases for this emoji.
    • getSlackAliases

      public List<String> getSlackAliases()
      Gets the Slack aliases for this emoji.
      Returns:
      The Slack aliases for this emoji.
    • getAllAliases

      public List<String> getAllAliases()
      Gets all the aliases for this emoji.
      Returns:
      All the aliases for this emoji.
    • hasFitzpatrickComponent

      public boolean hasFitzpatrickComponent()
      Checks if this emoji has a fitzpatrick modifier.
      Returns:
      True if this emoji has a fitzpatrick modifier, false otherwise.
    • hasHairStyleComponent

      public boolean hasHairStyleComponent()
      Checks if this emoji has a hairstyle modifier.
      Returns:
      True if this emoji has a hairstyle modifier, false otherwise.
    • getVersion

      public double getVersion()
      Gets the version this emoji was added to the Unicode consortium.
      Returns:
      The version this emoji was added to the Unicode consortium.
    • getQualification

      public Qualification getQualification()
      Gets the qualification of this emoji.
      Returns:
      The qualification of this emoji.
    • getDescription

      public String getDescription()
      Gets the description of this emoji.
      Returns:
      The description of this emoji.
    • getDescription

      public Optional<String> getDescription(EmojiLanguage emojiLanguage)
      Gets the description of this emoji in the specified language. May not be present for all languages.
      Parameters:
      emojiLanguage - The language type the description should be searched for.
      Returns:
      The description of this emoji in the specified language.
    • getKeywords

      public List<String> getKeywords()
      Gets the keywords of this emoji.
      Returns:
      The keywords of this emoji.
    • getKeywords

      public Optional<List<String>> getKeywords(EmojiLanguage emojiLanguage)
      Gets the keywords of this emoji in the specified language. May not be present for all languages.
      Parameters:
      emojiLanguage - The language type the keywords should be searched for.
      Returns:
      The keywords of this emoji in the specified language.
    • getGroup

      public EmojiGroup getGroup()
      Gets the group or "category" this emoji belongs to.
      Returns:
      The group this emoji belongs to.
    • getSubgroup

      public EmojiSubGroup getSubgroup()
      Gets the subgroup of this emoji.
      Returns:
      The subgroup of this emoji.
    • hasVariationSelectors

      public boolean hasVariationSelectors()
      Returns whether the emoji has text or emoji variations. This means the emoji is allowed to be appended with a FE0E or FE0F character to control how the emoji should be displayed.
      Returns:
      Whether the emoji is a standardized emoji that can be appended with a Variation Selector.
      See Also:
    • getTextVariation

      public Optional<String> getTextVariation()
      Gets the text representation of this emoji if the emoji is a standardized emoji that allows variations.
      Returns:
      The text variation of this emoji.
    • getEmojiVariation

      public Optional<String> getEmojiVariation()
      Gets the emoji representation of this emoji if the emoji is a standardized emoji that allows variations.
      Returns:
      The emoji variation of this emoji.
    • compareTo

      public int compareTo(Emoji o)
      Compares the emojis based on their codepoint length, and if they are equal, compare them lexicographically based on the emoji.
      Specified by:
      compareTo in interface Comparable<Emoji>
      Parameters:
      o - the object to be compared.
      Returns:
      Zero if they are fully equal, 1 if the emoji has more codepoints and has a higher Unicode value, otherwise return -1
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object