Package net.dv8tion.jda.api.utils.cache
Interface ChannelCacheView<T extends Channel>
- Type Parameters:
T
- The channel type
- All Superinterfaces:
CacheView<T>
,Iterable<T>
,SnowflakeCacheView<T>
- All Known Subinterfaces:
SortedChannelCacheView<T>
Specialized
This type caches all relevant channel types, including threads.
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.utils.cache.CacheView
CacheView.SimpleCacheView<T>
-
Method Summary
Modifier and TypeMethodDescriptiongetElementById
(ChannelType type, long id) Retrieves the entity represented by the provided ID.default T
getElementById
(ChannelType type, String id) Retrieves the entity represented by the provided ID.<C extends T>
ChannelCacheView<C>Creates a decorator around this cache, filtered to only provide access to the given type.Methods inherited from interface net.dv8tion.jda.api.utils.cache.CacheView
acceptStream, applyStream, asList, asSet, collect, forEachUnordered, getElementsByName, getElementsByName, isEmpty, lockedIterator, parallelStream, size, stream
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface net.dv8tion.jda.api.utils.cache.SnowflakeCacheView
getElementById, getElementById
-
Method Details
-
ofType
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 (LikeTextChannel.class
)- Returns:
- The filtered cache view
- Throws:
IllegalArgumentException
- If null is provided
-
getElementById
Retrieves the entity represented by the provided ID.- Parameters:
type
- The expectedChannelType
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
Retrieves the entity represented by the provided ID.- Parameters:
type
- The expectedChannelType
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 isnull
or cannot be resolved to an unsigned long id
-