Interface IPermissionContainerUnion

All Superinterfaces:
Channel, Comparable<GuildChannel>, Formattable, GuildChannel, IMentionable, IPermissionContainer, ISnowflake

public interface IPermissionContainerUnion extends IPermissionContainer
A union representing all channel types that implement IPermissionContainer.
This class extends IPermissionContainer and primarily acts as a discovery tool for developers to discover some common interfaces that a IPermissionContainer could be cast to.
This interface represents the follow concrete channel types:
  • Method Details

    • asTextChannel

      @Nonnull TextChannel asTextChannel()
      Casts this union to a TextChannel. This method exists for developer discoverability.

      Note: This is effectively equivalent to using the cast operator:

      
       //These are the same!
       TextChannel channel = union.asTextChannel();
       TextChannel channel2 = (TextChannel) union;
       
      You can use Channel.getType() to see if the channel is of type ChannelType.TEXT to validate whether you can call this method in addition to normal instanceof checks: channel instanceof TextChannel
      Returns:
      The channel as a TextChannel
      Throws:
      IllegalStateException - If the channel represented by this union is not actually a TextChannel.
    • asNewsChannel

      @Nonnull NewsChannel asNewsChannel()
      Casts this union to a NewsChannel. This method exists for developer discoverability.

      Note: This is effectively equivalent to using the cast operator:

      
       //These are the same!
       NewsChannel channel = union.asNewsChannel();
       NewsChannel channel2 = (NewsChannel) union;
       
      You can use Channel.getType() to see if the channel is of type ChannelType.NEWS to validate whether you can call this method in addition to normal instanceof checks: channel instanceof NewsChannel
      Returns:
      The channel as a NewsChannel
      Throws:
      IllegalStateException - If the channel represented by this union is not actually a NewsChannel.
    • asVoiceChannel

      @Nonnull VoiceChannel asVoiceChannel()
      Casts this union to a VoiceChannel. This method exists for developer discoverability.

      Note: This is effectively equivalent to using the cast operator:

      
       //These are the same!
       VoiceChannel channel = union.asVoiceChannel();
       VoiceChannel channel2 = (VoiceChannel) union;
       
      You can use Channel.getType() to see if the channel is of type ChannelType.VOICE to validate whether you can call this method in addition to normal instanceof checks: channel instanceof VoiceChannel
      Returns:
      The channel as a VoiceChannel
      Throws:
      IllegalStateException - If the channel represented by this union is not actually a VoiceChannel.
    • asStageChannel

      @Nonnull StageChannel asStageChannel()
      Casts this union to a StageChannel. This method exists for developer discoverability.

      Note: This is effectively equivalent to using the cast operator:

      
       //These are the same!
       StageChannel channel = union.asStageChannel();
       StageChannel channel2 = (StageChannel) union;
       
      You can use Channel.getType() to see if the channel is of type ChannelType.STAGE to validate whether you can call this method in addition to normal instanceof checks: channel instanceof StageChannel
      Returns:
      The channel as a StageChannel
      Throws:
      IllegalStateException - If the channel represented by this union is not actually a StageChannel.
    • asCategory

      @Nonnull Category asCategory()
      Casts this union to a Category. This method exists for developer discoverability.

      Note: This is effectively equivalent to using the cast operator:

      
       //These are the same!
       Category channel = union.asCategory();
       Category channel2 = (Category) union;
       
      You can use Channel.getType() to see if the channel is of type ChannelType.CATEGORY to validate whether you can call this method in addition to normal instanceof checks: channel instanceof Category
      Returns:
      The channel as a Category
      Throws:
      IllegalStateException - If the channel represented by this union is not actually a Category.
    • asForumChannel

      @Nonnull ForumChannel asForumChannel()
      Casts this union to a ForumChannel. This method exists for developer discoverability.

      Note: This is effectively equivalent to using the cast operator:

      
       //These are the same!
       ForumChannel channel = union.asForumChannel();
       ForumChannel channel2 = (ForumChannel) union;
       
      You can use Channel.getType() to see if the channel is of type ChannelType.FORUM to validate whether you can call this method in addition to normal instanceof checks: channel instanceof ForumChannel
      Returns:
      The channel as a ForumChannel
      Throws:
      IllegalStateException - If the channel represented by this union is not actually a ForumChannel.
    • asGuildMessageChannel

      @Nonnull GuildMessageChannel asGuildMessageChannel()
      Casts this union to a GuildMessageChannel. This method exists for developer discoverability.

      Note: This is effectively equivalent to using the cast operator:

      
       //These are the same!
       GuildMessageChannel channel = union.asGuildMessageChannel();
       GuildMessageChannel channel2 = (GuildMessageChannel) union;
       
      You can use Channel.getType().isGuild() and Channel.getType().isMessage() to validate whether you can call this method in addition to normal instanceof checks: channel instanceof GuildMessageChannel
      Returns:
      The channel as a GuildMessageChannel
      Throws:
      IllegalStateException - If the channel represented by this union is not actually a GuildMessageChannel.
    • asAudioChannel

      @Nonnull AudioChannel asAudioChannel()
      Casts this union to a AudioChannel. This method exists for developer discoverability.

      Note: This is effectively equivalent to using the cast operator:

      
       //These are the same!
       AudioChannel channel = union.asAudioChannel();
       AudioChannel channel2 = (AudioChannel) union;
       
      You can use Channel.getType().isAudio() to validate whether you can call this method in addition to normal instanceof checks: channel instanceof AudioChannel
      Returns:
      The channel as a AudioChannel
      Throws:
      IllegalStateException - If the channel represented by this union is not actually a AudioChannel.
    • asThreadContainer

      IThreadContainer asThreadContainer()
      Casts this union to a IThreadContainer. This method exists for developer discoverability.

      Note: This is effectively equivalent to using the cast operator:

      
       //These are the same!
       IThreadContainer channel = union.asThreadContainer();
       IThreadContainer channel2 = (IThreadContainer) union;
       
      You can use channel instanceof IThreadContainer to validate whether you can call this method.
      Returns:
      The channel as a IThreadContainer
      Throws:
      IllegalStateException - If the channel represented by this union is not actually a IThreadContainer.
    • asStandardGuildChannel

      @Nonnull StandardGuildChannel asStandardGuildChannel()
      Casts this union to a StandardGuildChannel. This method exists for developer discoverability.

      Note: This is effectively equivalent to using the cast operator:

      
       //These are the same!
       StandardGuildChannel channel = union.asStandardGuildChannel();
       StandardGuildChannel channel2 = (StandardGuildChannel) union;
       
      Returns:
      The channel as a StandardGuildChannel
      Throws:
      IllegalStateException - If the channel represented by this union is not actually a StandardGuildChannel.
    • asStandardGuildMessageChannel

      @Nonnull StandardGuildMessageChannel asStandardGuildMessageChannel()
      Casts this union to a StandardGuildMessageChannel. This method exists for developer discoverability.

      Note: This is effectively equivalent to using the cast operator:

      
       //These are the same!
       StandardGuildMessageChannel channel = union.asStandardGuildMessageChannel();
       StandardGuildMessageChannel channel2 = (StandardGuildMessageChannel) union;
       
      Returns:
      The channel as a StandardGuildMessageChannel
      Throws:
      IllegalStateException - If the channel represented by this union is not actually a StandardGuildMessageChannel.