Record Class BotListData

java.lang.Object
java.lang.Record
de.chojo.jdautil.botlist.BotListData
Record Components:
guilds - guild count
user - user count
shardId - id of the shard, or -1 for the whole bot
shardCount - total number of shards

public record BotListData(long guilds, long user, int shardId, int shardCount) extends Record
Statistics sent to a bot list, either for the whole bot or for a single shard.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BotListData(long guilds, long user, int shardId, int shardCount)
    Creates an instance of a BotListData record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    long
    Returns the value of the guilds record component.
    final int
    Returns a hash code value for this object.
    boolean
    Whether these statistics belong to a single shard.
    int
    Returns the value of the shardCount record component.
    int
    Returns the value of the shardId record component.
    shards(ShardManager shardManager)
    Statistics per shard, taken from the caches of each running shard.
    final String
    Returns a string representation of this record class.
    total(long guilds, long user, int shardCount)
    Statistics for the whole bot.
    total(ShardManager shardManager)
    Statistics for the whole bot, taken from the caches of the shard manager.
    long
    Returns the value of the user record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • BotListData

      public BotListData(long guilds, long user, int shardId, int shardCount)
      Creates an instance of a BotListData record class.
      Parameters:
      guilds - the value for the guilds record component
      user - the value for the user record component
      shardId - the value for the shardId record component
      shardCount - the value for the shardCount record component
  • Method Details

    • total

      public static BotListData total(long guilds, long user, int shardCount)
      Statistics for the whole bot.
      Parameters:
      guilds - guild count
      user - user count
      shardCount - total number of shards
      Returns:
      statistics without a shard id
    • total

      public static BotListData total(ShardManager shardManager)
      Statistics for the whole bot, taken from the caches of the shard manager.
      Parameters:
      shardManager - shard manager
      Returns:
      statistics without a shard id
    • shards

      public static List<BotListData> shards(ShardManager shardManager)
      Statistics per shard, taken from the caches of each running shard.
      Parameters:
      shardManager - shard manager
      Returns:
      one entry per running shard
    • isShard

      public boolean isShard()
      Whether these statistics belong to a single shard.
      Returns:
      true for shard statistics
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • guilds

      public long guilds()
      Returns the value of the guilds record component.
      Returns:
      the value of the guilds record component
    • user

      public long user()
      Returns the value of the user record component.
      Returns:
      the value of the user record component
    • shardId

      public int shardId()
      Returns the value of the shardId record component.
      Returns:
      the value of the shardId record component
    • shardCount

      public int shardCount()
      Returns the value of the shardCount record component.
      Returns:
      the value of the shardCount record component