public final class EntityUtil extends Object
Modifier and Type | Field and Description |
---|---|
static long |
DISCORD_EPOCH
The UNIX time that represents Discord's epoch (January 1, 2015).
|
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(ServiceMediator serviceMediator,
ChannelBean bean)
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. |
public static final long DISCORD_EPOCH
public static String getEmojiString(ReactionEmoji emoji)
public static Channel getChannel(ServiceMediator serviceMediator, ChannelBean bean)
ChannelBean
to its associated Channel
type
. That is to say, bean.getType() == Channel#getType().getValue()
.serviceMediator
- The ServiceMediator associated to this object, must be non-null.bean
- 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.