Interface Entity

All Known Subinterfaces:
ApplicationCommand, ApplicationCommandInteraction, ApplicationCommandInteractionData, ApplicationInfo, ApplicationOwner, AuditLogChange, AuditLogEntry, BulkDeletedMessages, BulkRemovedReactions, ButtonInteraction, Category, Channel, ChannelMention, ChannelPinsUpdate, ChunkingDone, CreatedInvite, DeletedMessage, DeletedThread, DMChannel, Emoji, Emoji.ActivityEmoji, Emoji.CustomEmoji, Emoji.UnicodeEmoji, EmojiUpdate, GatewayClosed, GatewayConnectionFailed, GatewayGuildBan, GatewayInfo, GroupDMChannel, Guild, GuildBan, GuildChannel, GuildEmbed, GuildEntity, HasOwner, HasUser, HighWebsocketLatency, Interaction<T>, InteractionMember, Invite, Invite.InviteChannel, Invite.InviteGuild, Invite.Inviter, Member, MemberChunkRerequest, MemberDisconnectInfo, MemberMoveInfo, MemberPruneInfo, Message, Message.Attachment, MessageBulkDeleteInfo, MessageChannel, MessageDeleteInfo, MessageEmbedUpdate, MessagePinInfo, MessageReference, NewsChannel, OptionalEntryInfo, OverrideUpdateInfo, PartialGuild, PartialMember, PartialRole, Permissable, PermissionOverride, PresenceUpdate, ReactionUpdate, Ready, RequiresCatnip, RestRatelimitHit, Resumed, Role, SelectInteraction, Snowflake, StageChannel, Sticker, StoreChannel, TaskScheduler, Team, TextChannel, ThreadChannel, ThreadChannel.ThreadMember, ThreadMembersUpdate, TypingUser, UnavailableGuild, User, UserDMChannel, VoiceChannel, VoiceRegion, VoiceServerUpdate, VoiceState, Webhook, WebhooksUpdate
All Known Implementing Classes:
AbstractTaskScheduler, ActivityEmojiImpl, ApplicationCommandImpl, ApplicationCommandInteractionDataImpl, ApplicationCommandInteractionDataOptionImpl, ApplicationCommandInteractionImpl, ApplicationCommandOptionDoubleChoiceImpl, ApplicationCommandOptionIntegerChoiceImpl, ApplicationInfoImpl, ApplicationOwnerImpl, AttachmentImpl, AuditLogChangeImpl, AuditLogEntryImpl, BulkDeletedMessagesImpl, BulkRemovedReactionsImpl, ButtonInteractionImpl, CategoryImpl, ChannelMentionImpl, ChannelPinsUpdateImpl, ChunkingDoneImpl, CreatedInviteImpl, CustomEmojiImpl, DeletedInviteImpl, DeletedMessageImpl, DeletedThreadImpl, EmojiUpdateImpl, GatewayClosedImpl, GatewayConnectionFailedImpl, GatewayGuildBanImpl, GatewayInfoImpl, GroupDMChannelImpl, GuildBanImpl, GuildEmbedImpl, GuildImpl, HighWebsocketLatencyImpl, InteractionMemberImpl, InviteImpl, InviteImpl.InviteChannelImpl, InviteImpl.InviteGuildImpl, InviteImpl.InviterImpl, MemberChunkRerequestImpl, MemberDisconnectInfoImpl, MemberImpl, MemberMoveInfoImpl, MemberPruneInfoImpl, MessageBulkDeleteInfoImpl, MessageDeleteInfoImpl, MessageEmbedUpdateImpl, MessageImpl, MessagePinInfoImpl, MessageReferenceImpl, NewsChannelImpl, OverrideUpdateInfoImpl, PartialGuildImpl, PartialMemberImpl, PartialRoleImpl, PermissionOverrideImpl, PresenceImpl, PresenceUpdateImpl, ReactionUpdateImpl, ReadyImpl, RestRatelimitHitImpl, ResumedImpl, RoleImpl, RxTaskScheduler, SelectInteractionImpl, StageChannelImpl, StickerImpl, StoreChannelImpl, TeamImpl, TeamMemberImpl, TextChannelImpl, ThreadChannelImpl, ThreadChannelImpl.ThreadMemberImpl, ThreadMembersUpdateImpl, TypingUserImpl, UnavailableGuildImpl, UnicodeEmojiImpl, UserDMChannelImpl, UserImpl, VoiceChannelImpl, VoiceRegionImpl, VoiceServerUpdateImpl, VoiceStateImpl, WebhookImpl, WebhooksUpdateImpl

public interface Entity
A single entity in catnip. An entity is any data received from Discord that can be serialized or deserialized, as well as a class that must have a catnip instance attached to it.
Since:
5/9/18.
Author:
natanbc
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the catnip instance associated with this entity.
    static <T, E extends Entity>
    E
    deserialize(Catnip catnip, Class<E> type, T data)
    Deserialize the given data into an entity of the given type, with the provided catnip instanced attached to it.
    default <T> T
    Serialize this entity.
  • Method Details

    • deserialize

      @Nonnull @CheckReturnValue static <T, E extends Entity> E deserialize(@Nonnull Catnip catnip, @Nonnull Class<E> type, @Nonnull T data)
      Deserialize the given data into an entity of the given type, with the provided catnip instanced attached to it.
      Type Parameters:
      T - The type of data being deserialized.
      E - The type of entity being deserialized.
      Parameters:
      catnip - The catnip instance to attach.
      type - The type of entity to deserialize to.
      data - The data to be deserialized.
      Returns:
      The deserialized entity.
    • catnip

      Catnip catnip()
      Returns the catnip instance associated with this entity.
      Returns:
      The catnip instance of this entity.
    • serialize

      @Nonnull @CheckReturnValue default <T> T serialize()
      Serialize this entity. Returns whatever type of data the configured serializer returns -- not necessarily JSON!
      Type Parameters:
      T - The type of serialized data.
      Returns:
      The serialized data.