Interface ChannelCacheView<T extends Channel>

Type Parameters:
T - The channel type
All Superinterfaces:
CacheView<T>, Iterable<T>, SnowflakeCacheView<T>
All Known Subinterfaces:
SortedChannelCacheView<T>

public interface ChannelCacheView<T extends Channel> extends SnowflakeCacheView<T>
Specialized SnowflakeCacheView type used for handling channels.
This type caches all relevant channel types, including threads.

Internally, this cache view makes a distinction between the varying ChannelTypes and provides convenient methods to access a filtered subset.

  • Method Details

    • ofType

      @Nonnull <C extends T> ChannelCacheView<C> ofType(@Nonnull Class<C> type)
      Creates a decorator around this cache, filtered to only provide access to the given type.
      Type Parameters:
      C - The type parameter
      Parameters:
      type - The type class (Like TextChannel.class)
      Returns:
      The filtered cache view
      Throws:
      IllegalArgumentException - If null is provided
    • getElementById

      @Nullable T getElementById(@Nonnull ChannelType type, long id)
      Retrieves the entity represented by the provided ID.
      Parameters:
      type - The expected ChannelType
      id - The ID of the entity
      Returns:
      Possibly-null entity for the specified ID, null if the expected type is different from the actual type
    • getElementById

      @Nullable default T getElementById(@Nonnull ChannelType type, @Nonnull String id)
      Retrieves the entity represented by the provided ID.
      Parameters:
      type - The expected ChannelType
      id - The ID of the entity
      Returns:
      Possibly-null entity for the specified ID, null if the expected type is different from the actual type
      Throws:
      NumberFormatException - If the provided String is null or cannot be resolved to an unsigned long id