Interface RoleManager

  • All Superinterfaces:
    AuditableRestAction<java.lang.Void>, Manager<RoleManager>, RestAction<java.lang.Void>

    public interface RoleManager
    extends Manager<RoleManager>
    Manager providing functionality to update one or more fields for a Role.

    Example

    
     manager.setName("Administrator")
            .setColor(null)
            .queue();
     manager.reset(RoleManager.PERMISSION | RoleManager.NAME)
            .setName("Traitor")
            .setColor(Color.RED)
            .queue();
     
    See Also:
    Role.getManager()
    • Method Detail

      • reset

        @Nonnull
        RoleManager reset​(long fields)
        Resets the fields specified by the provided bit-flag pattern. You can specify a combination by using a bitwise OR concat of the flag constants.
        Example: manager.reset(RoleManager.COLOR | RoleManager.NAME);

        Flag Constants:

        Specified by:
        reset in interface Manager<RoleManager>
        Parameters:
        fields - Integer value containing the flags to reset.
        Returns:
        RoleManager for chaining convenience
      • reset

        @Nonnull
        RoleManager reset​(long... fields)
        Resets the fields specified by the provided bit-flag patterns. You can specify a combination by using a bitwise OR concat of the flag constants.
        Example: manager.reset(RoleManager.COLOR, RoleManager.NAME);

        Flag Constants:

        Specified by:
        reset in interface Manager<RoleManager>
        Parameters:
        fields - Integer values containing the flags to reset.
        Returns:
        RoleManager for chaining convenience
      • getRole

        @Nonnull
        Role getRole()
        The target Role for this manager
        Returns:
        The target Role
      • getGuild

        @Nonnull
        default Guild getGuild()
        The Guild this Manager's Role is in.
        This is logically the same as calling getRole().getGuild()
        Returns:
        The parent Guild
      • setName

        @Nonnull
        @CheckReturnValue
        RoleManager setName​(@Nonnull
                            java.lang.String name)
        Sets the name of the selected Role.

        A role name must not be null nor less than 1 characters or more than 32 characters long!

        Parameters:
        name - The new name for the selected Role
        Returns:
        RoleManager for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If the provided name is null or not between 1-100 characters long
      • setPermissions

        @Nonnull
        @CheckReturnValue
        RoleManager setPermissions​(long perms)
        Sets the Permissions of the selected Role.

        Permissions may only include already present Permissions for the currently logged in account.
        You are unable to give permissions you don't have!

        Parameters:
        perms - The new raw permission value for the selected Role
        Returns:
        RoleManager for chaining convenience
        Throws:
        InsufficientPermissionException - If the currently logged in account does not have permission to apply one of the specified permissions
        See Also:
        setPermissions(Collection), setPermissions(Permission...)
      • setPermissions

        @Nonnull
        @CheckReturnValue
        default RoleManager setPermissions​(@Nonnull
                                           java.util.Collection<Permission> permissions)
        Sets the Permissions of the selected Role.

        Permissions may only include already present Permissions for the currently logged in account.
        You are unable to give permissions you don't have!

        Parameters:
        permissions - The new permission for the selected Role
        Returns:
        RoleManager for chaining convenience
        Throws:
        InsufficientPermissionException - If the currently logged in account does not have permission to apply one of the specified permissions
        java.lang.IllegalArgumentException - If any of the provided values is null
        See Also:
        setPermissions(Permission...), setPermissions(long), EnumSet, Permission.getRaw(Collection)
      • setColor

        @Nonnull
        @CheckReturnValue
        default RoleManager setColor​(@Nullable
                                     java.awt.Color color)
        Sets the Color of the selected Role.
        Parameters:
        color - The new color for the selected Role
        Returns:
        RoleManager for chaining convenience
      • setColor

        @Nonnull
        @CheckReturnValue
        RoleManager setColor​(int rgb)
        Sets the rgb color of the selected Role.
        Parameters:
        rgb - The new color for the selected Role
        Returns:
        RoleManager for chaining convenience
        See Also:
        Role.DEFAULT_COLOR_RAW
      • setHoisted

        @Nonnull
        @CheckReturnValue
        RoleManager setHoisted​(boolean hoisted)
        Sets the hoist state of the selected Role.
        Parameters:
        hoisted - Whether the selected Role should be hoisted
        Returns:
        RoleManager for chaining convenience
      • setMentionable

        @Nonnull
        @CheckReturnValue
        RoleManager setMentionable​(boolean mentionable)
        Sets the mentionable state of the selected Role.
        Parameters:
        mentionable - Whether the selected Role should be mentionable
        Returns:
        RoleManager for chaining convenience
      • setIcon

        @Nonnull
        @CheckReturnValue
        RoleManager setIcon​(@Nullable
                            Icon icon)
        Sets the Icon of this Role.
        Parameters:
        icon - The new icon for this Role or null to reset
        Returns:
        RoleManager for chaining convenience
      • setIcon

        @Nonnull
        @CheckReturnValue
        RoleManager setIcon​(@Nullable
                            java.lang.String emoji)
        Sets the Unicode Emoji of this Role instead of a custom image.
        Parameters:
        emoji - The new Unicode Emoji for this Role or null to reset
        Returns:
        RoleManager for chaining convenience