Class AbstractChannelImpl<T extends AbstractChannelImpl<T>>

java.lang.Object
net.dv8tion.jda.internal.entities.channel.AbstractChannelImpl<T>
All Implemented Interfaces:
Formattable, Channel, ChannelUnion, IDetachableEntity, IMentionable, ISnowflake, ChannelMixin<T>, IDetachableEntityMixin
Direct Known Subclasses:
AbstractGuildChannelImpl, DetachedGroupChannelImpl, DetachedPrivateChannelImpl, PrivateChannelImpl

public abstract class AbstractChannelImpl<T extends AbstractChannelImpl<T>> extends Object implements ChannelMixin<T>
  • Constructor Details

    • AbstractChannelImpl

      public AbstractChannelImpl(long id, JDA api)
  • Method Details

    • getJDA

      @Nonnull public JDA getJDA()
      Description copied from interface: Channel
      Returns the JDA instance of this channel
      Specified by:
      getJDA in interface Channel
      Returns:
      the corresponding JDA instance
    • getIdLong

      public long getIdLong()
      Description copied from interface: ISnowflake
      The Snowflake id of this entity. This is unique to every entity and will never change.
      Specified by:
      getIdLong in interface ISnowflake
      Returns:
      Long containing the Id.
    • getName

      @Nonnull public String getName()
      Description copied from interface: Channel
      The human readable name of this channel.

      May be an empty string for GroupChannels with no name (Group DMs with no name displays the recipients on the Discord client).

      Specified by:
      getName in interface Channel
      Returns:
      The name of this channel
    • setName

      public T setName(String name)
      Specified by:
      setName in interface ChannelMixin<T extends AbstractChannelImpl<T>>
    • asPrivateChannel

      @Nonnull public PrivateChannel asPrivateChannel()
      Description copied from interface: ChannelUnion
      Casts this union to a PrivateChannel. This method exists for developer discoverability.

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

      
       //These are the same!
       PrivateChannel channel = union.asPrivateChannel();
       PrivateChannel channel2 = (PrivateChannel) union;
       
      You can use Channel.getType() to see if the channel is of type ChannelType.PRIVATE to validate whether you can call this method in addition to normal instanceof checks: channel instanceof PrivateChannel
      Specified by:
      asPrivateChannel in interface ChannelUnion
      Returns:
      The channel as a PrivateChannel
    • asGroupChannel

      @Nonnull public GroupChannel asGroupChannel()
      Description copied from interface: ChannelUnion
      Casts this union to a GroupChannel. This method exists for developer discoverability.

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

      
       //These are the same!
       GroupChannel channel = union.asGroupChannel();
       GroupChannel channel2 = (GroupChannel) union;
       
      You can use Channel.getType() to see if the channel is of type ChannelType.GROUP to validate whether you can call this method in addition to normal instanceof checks: channel instanceof GroupChannel
      Specified by:
      asGroupChannel in interface ChannelUnion
      Returns:
      The channel as a GroupChannel
    • asTextChannel

      @Nonnull public TextChannel asTextChannel()
      Description copied from interface: ChannelUnion
      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
      Specified by:
      asTextChannel in interface ChannelUnion
      Returns:
      The channel as a TextChannel
    • asNewsChannel

      @Nonnull public NewsChannel asNewsChannel()
      Description copied from interface: ChannelUnion
      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
      Specified by:
      asNewsChannel in interface ChannelUnion
      Returns:
      The channel as a NewsChannel
    • asVoiceChannel

      @Nonnull public VoiceChannel asVoiceChannel()
      Description copied from interface: ChannelUnion
      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
      Specified by:
      asVoiceChannel in interface ChannelUnion
      Returns:
      The channel as a VoiceChannel
    • asStageChannel

      @Nonnull public StageChannel asStageChannel()
      Description copied from interface: ChannelUnion
      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
      Specified by:
      asStageChannel in interface ChannelUnion
      Returns:
      The channel as a StageChannel
    • asThreadChannel

      @Nonnull public ThreadChannel asThreadChannel()
      Description copied from interface: ChannelUnion
      Casts this union to a ThreadChannel. This method exists for developer discoverability.

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

      
       //These are the same!
       ThreadChannel channel = union.asThreadChannel();
       ThreadChannel channel2 = (ThreadChannel) union;
       
      You can use Channel.getType().isThread() to validate whether you can call this method in addition to normal instanceof checks: channel instanceof ThreadChannel
      Specified by:
      asThreadChannel in interface ChannelUnion
      Returns:
      The channel as a ThreadChannel
    • asCategory

      @Nonnull public Category asCategory()
      Description copied from interface: ChannelUnion
      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
      Specified by:
      asCategory in interface ChannelUnion
      Returns:
      The channel as a Category
    • asForumChannel

      @Nonnull public ForumChannel asForumChannel()
      Description copied from interface: ChannelUnion
      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
      Specified by:
      asForumChannel in interface ChannelUnion
      Returns:
      The channel as a ForumChannel
    • asMediaChannel

      @Nonnull public MediaChannel asMediaChannel()
      Description copied from interface: ChannelUnion
      Casts this union to a MediaChannel. This method exists for developer discoverability.

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

      
       //These are the same!
       MediaChannel channel = union.asMediaChannel();
       MediaChannel channel2 = (MediaChannel) union;
       
      You can use Channel.getType() to see if the channel is of type ChannelType.MEDIA to validate whether you can call this method in addition to normal instanceof checks: channel instanceof MediaChannel
      Specified by:
      asMediaChannel in interface ChannelUnion
      Returns:
      The channel as a MediaChannel
    • asMessageChannel

      @Nonnull public MessageChannel asMessageChannel()
      Description copied from interface: ChannelUnion
      Casts this union to a MessageChannel. This method exists for developer discoverability.

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

      
       //These are the same!
       MessageChannel channel = union.asMessageChannel();
       MessageChannel channel2 = (MessageChannel) union;
       
      You can use Channel.getType().isMessage() to validate whether you can call this method in addition to normal instanceof checks: channel instanceof MessageChannel
      Specified by:
      asMessageChannel in interface ChannelUnion
      Returns:
      The channel as a MessageChannel
    • asAudioChannel

      @Nonnull public AudioChannel asAudioChannel()
      Description copied from interface: ChannelUnion
      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
      Specified by:
      asAudioChannel in interface ChannelUnion
      Returns:
      The channel as a AudioChannel
    • asThreadContainer

      @Nonnull public IThreadContainer asThreadContainer()
      Description copied from interface: ChannelUnion
      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.
      Specified by:
      asThreadContainer in interface ChannelUnion
      Returns:
      The channel as a IThreadContainer
    • asGuildChannel

      @Nonnull public GuildChannel asGuildChannel()
      Description copied from interface: ChannelUnion
      Casts this union to a GuildChannel. This method exists for developer discoverability.

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

      
       //These are the same!
       GuildChannel channel = union.asGuildChannel();
       GuildChannel channel2 = (GuildChannel) union;
       
      You can use Channel.getType()isGuild() to validate whether you can call this method in addition to normal instanceof checks: channel instanceof GuildChannel
      Specified by:
      asGuildChannel in interface ChannelUnion
      Returns:
      The channel as a GuildChannel
    • asGuildMessageChannel

      @Nonnull public GuildMessageChannel asGuildMessageChannel()
      Description copied from interface: ChannelUnion
      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
      Specified by:
      asGuildMessageChannel in interface ChannelUnion
      Returns:
      The channel as a GuildMessageChannel
    • asStandardGuildChannel

      @Nonnull public StandardGuildChannel asStandardGuildChannel()
      Description copied from interface: ChannelUnion
      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;
       
      Specified by:
      asStandardGuildChannel in interface ChannelUnion
      Returns:
      The channel as a StandardGuildChannel
    • asStandardGuildMessageChannel

      @Nonnull public StandardGuildMessageChannel asStandardGuildMessageChannel()
      Description copied from interface: ChannelUnion
      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;
       
      Specified by:
      asStandardGuildMessageChannel in interface ChannelUnion
      Returns:
      The channel as a StandardGuildMessageChannel
    • toString

      public String toString()
      Overrides:
      toString in class Object