Class Emoji


  • public class Emoji
    extends Object
    This class represents an emoji.

    This object is immutable, so it can be used safely in a multi-threaded context.

    • Method Detail

      • getDescription

        @NotNull
        public @NotNull String getDescription()
        Returns the description of the emoji
        Returns:
        the description
      • supportsFitzpatrick

        public boolean supportsFitzpatrick()
        Returns whether the emoji supports the Fitzpatrick modifiers or not
        Returns:
        true if the emoji supports the Fitzpatrick modifiers
      • supportsVariation

        public boolean supportsVariation()
        Returns whether the emoji supports a variation selection modifier or not
        Returns:
        true, if the emoji supports variation selector
      • getAliases

        @NotNull
        public @NotNull List<String> getAliases()
        Returns the aliases of the emoji
        Returns:
        Immutable list of aliases
      • getTags

        @NotNull
        public @NotNull List<String> getTags()
        Returns the tags of the emoji
        Returns:
        Immutable list if tags
      • getUnicode

        @NotNull
        public @NotNull String getUnicode()
        Returns the unicode representation of the emoji
        Returns:
        the unicode representation
      • getTrimmedUnicode

        @NotNull
        public @NotNull String getTrimmedUnicode()
        Returns the unicode representation of the emoji without the variation selector
        Returns:
        the unicode representation without variation selector
      • getUnicode

        @NotNull
        public @NotNull String getUnicode​(@Nullable
                                          @Nullable Fitzpatrick fitzpatrick)
        Returns the unicode representation of the emoji associated with the provided Fitzpatrick modifier.
        If the modifier is null, then the result is similar to getUnicode().
        Parameters:
        fitzpatrick - the fitzpatrick modifier or null
        Returns:
        the unicode representation
        Throws:
        IllegalStateException - if the emoji doesn't support the Fitzpatrick modifiers
      • getTrimmedUnicode

        @NotNull
        public @NotNull String getTrimmedUnicode​(@Nullable
                                                 @Nullable Fitzpatrick fitzpatrick)
        Returns the unicode representation of the emoji associated with the provided Fitzpatrick modifier.
        If the modifier is null, then the result is similar to getTrimmedUnicode().
        Parameters:
        fitzpatrick - the fitzpatrick modifier or null
        Returns:
        the unicode representation
        Throws:
        IllegalStateException - if the emoji doesn't support the Fitzpatrick modifiers
      • getHtmlDecimal

        @NotNull
        public @NotNull String getHtmlDecimal()
        Returns the HTML decimal representation of the emoji
        Returns:
        the HTML decimal representation
      • getHtmlHexadecimal

        @NotNull
        public @NotNull String getHtmlHexadecimal()
        Returns the HTML hexadecimal representation of the emoji
        Returns:
        the HTML hexadecimal representation
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • toString

        @NotNull
        public @NotNull String toString()
        Returns the String representation of the Emoji object.

        Example

        Emoji {
         description='smiling face with open mouth and smiling eyes',
         supportsFitzpatrick=false,
         aliases=[smile],
         tags=[happy, joy, pleased],
         category='Smileys & Emotion',
         unicode='😄',
         htmlDec='&#128516;',
         htmlHex='&#x1f604;'
         }
        Overrides:
        toString in class Object
        Returns:
        the string representation