public final class EntityUtil extends Object
Modifier and Type | Field and Description |
---|---|
static long |
DISCORD_EPOCH
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
equals(Entity entity,
Object obj)
An utility that checks for equality between an entity and a generic object.
|
static Channel |
getChannel(GatewayDiscordClient gateway,
discord4j.discordjson.json.ChannelData data)
An utility that converts some instance of
ChannelBean to its associated Channel
type . |
static String |
getEmojiString(ReactionEmoji emoji) |
static int |
hashCode(Entity entity)
An utility that gets the hash code of an entity.
|
static <T> T |
throwUnsupportedDiscordValue(Object value)
Throws an
UnsupportedOperationException for an unknown Discord value. |
@Deprecated public static final long DISCORD_EPOCH
Snowflake.DISCORD_EPOCH
.public static String getEmojiString(ReactionEmoji emoji)
public static Channel getChannel(GatewayDiscordClient gateway, discord4j.discordjson.json.ChannelData data)
ChannelBean
to its associated Channel
type
. That is to say, data.getType() == Channel#getType().getValue()
.gateway
- The GatewayDiscordClient
associated to this object, must be non-null.data
- The ChannelBean
to convert.Channel
.public static <T> T throwUnsupportedDiscordValue(Object value)
UnsupportedOperationException
for an unknown Discord value. This method is intended to be used
in enum value constructs such as Channel.Type#of(int)
when the value has not been properly supported.T
- The return type. Used to simulate bottom type.value
- The unknown Discord value.public static boolean equals(Entity entity, @Nullable Object obj)
entity
- The entity to compare to.obj
- The object to compare to.true
if the two objects are equal, false
otherwise.public static int hashCode(Entity entity)
entity
- The entity to get a hash code from.