Class PermissionOverwrite

java.lang.Object
discord4j.core.object.PermissionOverwrite
Direct Known Subclasses:
ExtendedPermissionOverwrite

public class PermissionOverwrite extends Object
  • Method Details

    • forMember

      public static PermissionOverwrite forMember(Snowflake memberId, PermissionSet allowed, PermissionSet denied)
      Constructs a PermissionOverwrite targeting a Member.
      Parameters:
      memberId - The ID of the member to target.
      allowed - The permissions explicitly allowed by the overwrite.
      denied - The permissions explicitly denied by the overwrite.
      Returns:
      A PermissionOverwrite targeting the given member.
    • forRole

      public static PermissionOverwrite forRole(Snowflake roleId, PermissionSet allowed, PermissionSet denied)
      Constructs a PermissionOverwrite targeting a Role.
      Parameters:
      roleId - The ID of the role to target.
      allowed - The permissions explicitly allowed by the overwrite.
      denied - The permissions explicitly denied by the overwrite.
      Returns:
      A PermissionOverwrite targeting the given role.
    • getData

      public discord4j.discordjson.json.OverwriteData getData()
      Map this PermissionOverwrite object to a OverwriteData JSON.
      Returns:
      JSON object.
    • getAllowed

      public PermissionSet getAllowed()
      Gets the permissions explicitly allowed by this overwrite.
      Returns:
      The permissions explicitly allowed by this overwrite.
    • getDenied

      public PermissionSet getDenied()
      Gets the permissions explicitly denied by this overwrite.
      Returns:
      The permissions explicitly denied by this overwrite.
    • getTargetId

      public Snowflake getTargetId()
      Gets the ID of the entity this overwrite targets. This is either a role ID or a member ID.
      Returns:
      The ID of the entity this overwrite targets.
      See Also:
    • getRoleId

      public Optional<Snowflake> getRoleId()
      Gets the ID of the role this overwrite targets.
      Returns:
      The ID of the role this overwrite targets.
    • getMemberId

      public Optional<Snowflake> getMemberId()
      Gets the ID of the member this overwrite targets.
      Returns:
      The ID of the member this overwrite targets.
    • getType

      public PermissionOverwrite.Type getType()
      Gets the type of the overwrite.
      Returns:
      The type of the overwrite.
    • toString

      public String toString()
      Overrides:
      toString in class Object