Package net.dv8tion.jda.api.utils.cache
Interface ShardCacheView
Read-only view on internal ShardManager cache of JDA instances.
This can be useful to check information such as size without creating an immutable snapshot first.
This can be useful to check information such as size without creating an immutable snapshot first.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.utils.cache.CacheView
CacheView.SimpleCacheView<T> -
Method Summary
Modifier and TypeMethodDescriptiongetElementById(int id) Retrieves the JDA instance represented by the provided shard ID.default JDAgetElementById(String id) Retrieves the JDA instance represented by the provided shard ID ornullif none of the connected shards match the provided id.Methods inherited from interface net.dv8tion.jda.api.utils.cache.CacheView
acceptStream, applyStream, asList, asSet, collect, forEachUnordered, getElementsByName, getElementsByName, isEmpty, lockedIterator, parallelStream, size, streamMethods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
getElementById
Retrieves the JDA instance represented by the provided shard ID.- Parameters:
id- The ID of the entity- Returns:
- Possibly-null entity for the specified shard ID
-
getElementById
Retrieves the JDA instance represented by the provided shard ID ornullif none of the connected shards match the provided id.- Parameters:
id- The ID of the shard- Returns:
- Possibly-null entity for the specified shard ID
- Throws:
NumberFormatException- If the provided String isnullor cannot be resolved to an unsigned int id
-