Class RoleImpl

    • Constructor Detail

      • RoleImpl

        public RoleImpl​(DiscordApiImpl api,
                        ServerImpl server,
                        com.fasterxml.jackson.databind.JsonNode data)
        Creates a new role object.
        Parameters:
        api - The discord api instance.
        server - The server of the role.
        data - The json data of the role.
    • Method Detail

      • getColorAsInt

        public int getColorAsInt()
        Gets the color of the role as int.
        Returns:
        The color of the role as int.
      • setColor

        public void setColor​(int color)
        Sets the color of the role.
        Parameters:
        color - The color to set.
      • setHoist

        public void setHoist​(boolean hoist)
        Sets the hoist flag of the role.
        Parameters:
        hoist - The hoist flag to set.
      • setMentionable

        public void setMentionable​(boolean mentionable)
        Sets the mentionable flag of the role.
        Parameters:
        mentionable - The mentionable flag to set.
      • setName

        public void setName​(java.lang.String name)
        Sets the name of the role.
        Parameters:
        name - The name to set.
      • setPermissions

        public void setPermissions​(PermissionsImpl permissions)
        Sets the permissions of the role.
        Parameters:
        permissions - The permissions to set.
      • setRawPosition

        public void setRawPosition​(int position)
        Sets the raw position of the role.
        Parameters:
        position - The raw position to set.
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface Nameable
      • getRawPosition

        public int getRawPosition()
        Specified by:
        getRawPosition in interface Role
      • getIconHash

        public java.util.Optional<java.lang.String> getIconHash()
        Specified by:
        getIconHash in interface Role
      • getIcon

        public java.util.Optional<Icon> getIcon()
        Specified by:
        getIcon in interface Role
      • getIcon

        public java.util.Optional<Icon> getIcon​(int size)
        Specified by:
        getIcon in interface Role
      • getUnicodeEmojiIcon

        public java.util.Optional<java.lang.String> getUnicodeEmojiIcon()
        Specified by:
        getUnicodeEmojiIcon in interface Role
      • getColor

        public java.util.Optional<java.awt.Color> getColor()
        Specified by:
        getColor in interface Role
      • isMentionable

        public boolean isMentionable()
        Specified by:
        isMentionable in interface Role
      • getUsers

        public java.util.Set<User> getUsers()
        Specified by:
        getUsers in interface Role
      • hasUser

        public boolean hasUser​(User user)
        Specified by:
        hasUser in interface Role
      • isManaged

        public boolean isManaged()
        Specified by:
        isManaged in interface Role
      • delete

        public java.util.concurrent.CompletableFuture<java.lang.Void> delete​(java.lang.String reason)
        Specified by:
        delete in interface Deletable
      • compareTo

        public int compareTo​(Role role)

        Implementation note: Only roles from the same server can be compared

        Specified by:
        compareTo in interface java.lang.Comparable<Role>
        Throws:
        java.lang.IllegalArgumentException - If the roles are on different servers.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object