Interface UpdateEvent<E,T>

Type Parameters:
E - The entity type
T - The value type
All Superinterfaces:
GenericEvent
All Known Subinterfaces:
GuildVoiceUpdateEvent
All Known Implementing Classes:
ChannelUpdateArchivedEvent, ChannelUpdateArchiveTimestampEvent, ChannelUpdateAutoArchiveDurationEvent, ChannelUpdateBitrateEvent, ChannelUpdateInvitableEvent, ChannelUpdateLockedEvent, ChannelUpdateNameEvent, ChannelUpdateNSFWEvent, ChannelUpdateParentEvent, ChannelUpdatePositionEvent, ChannelUpdateRegionEvent, ChannelUpdateSlowmodeEvent, ChannelUpdateTopicEvent, ChannelUpdateTypeEvent, ChannelUpdateUserLimitEvent, EmoteUpdateNameEvent, EmoteUpdateRolesEvent, GatewayPingEvent, GenericChannelUpdateEvent, GenericEmoteUpdateEvent, GenericGuildMemberUpdateEvent, GenericGuildUpdateEvent, GenericGuildVoiceUpdateEvent, GenericRoleUpdateEvent, GenericSelfUpdateEvent, GenericStageInstanceUpdateEvent, GenericUserUpdateEvent, GuildMemberUpdateAvatarEvent, GuildMemberUpdateBoostTimeEvent, GuildMemberUpdateNicknameEvent, GuildMemberUpdatePendingEvent, GuildMemberUpdateTimeOutEvent, GuildUpdateAfkChannelEvent, GuildUpdateAfkTimeoutEvent, GuildUpdateBannerEvent, GuildUpdateBoostCountEvent, GuildUpdateBoostTierEvent, GuildUpdateCommunityUpdatesChannelEvent, GuildUpdateDescriptionEvent, GuildUpdateExplicitContentLevelEvent, GuildUpdateFeaturesEvent, GuildUpdateIconEvent, GuildUpdateLocaleEvent, GuildUpdateMaxMembersEvent, GuildUpdateMaxPresencesEvent, GuildUpdateMFALevelEvent, GuildUpdateNameEvent, GuildUpdateNotificationLevelEvent, GuildUpdateNSFWLevelEvent, GuildUpdateOwnerEvent, GuildUpdateRulesChannelEvent, GuildUpdateSplashEvent, GuildUpdateSystemChannelEvent, GuildUpdateVanityCodeEvent, GuildUpdateVerificationLevelEvent, GuildVoiceJoinEvent, GuildVoiceLeaveEvent, GuildVoiceMoveEvent, RoleUpdateColorEvent, RoleUpdateHoistedEvent, RoleUpdateIconEvent, RoleUpdateMentionableEvent, RoleUpdateNameEvent, RoleUpdatePermissionsEvent, RoleUpdatePositionEvent, SelfUpdateAvatarEvent, SelfUpdateDiscriminatorEvent, SelfUpdateMFAEvent, SelfUpdateNameEvent, SelfUpdateVerifiedEvent, StageInstanceUpdatePrivacyLevelEvent, StageInstanceUpdateTopicEvent, StatusChangeEvent, UserUpdateActivitiesEvent, UserUpdateActivityOrderEvent, UserUpdateAvatarEvent, UserUpdateDiscriminatorEvent, UserUpdateFlagsEvent, UserUpdateNameEvent, UserUpdateOnlineStatusEvent

public interface UpdateEvent<E,T> extends GenericEvent
Indicates that a value of an entity was updated
  • Method Details

    • getEntityType

      @Nonnull default Class<E> getEntityType()
      Class representation of the affected entity, useful when dealing with refection.
      Returns:
      The class of the affected entity
    • getPropertyIdentifier

      @Nonnull String getPropertyIdentifier()
      The field name for the updated property

      Example

      
       @Override
       public void onGenericRoleUpdate(GenericRoleUpdateEvent event)
       {
           switch (event.getPropertyIdentifier())
           {
           case RoleUpdateColorEvent.IDENTIFIER:
               System.out.printf("Updated color for role: %s%n", event);
               break;
           case RoleUpdatePositionEvent.IDENTIFIER:
               RoleUpdatePositionEvent update = (RoleUpdatePositionEvent) event;
               System.out.printf("Updated position for role: %s raw(%s->%s)%n", event, update.getOldPositionRaw(), update.getNewPositionRaw());
               break;
           default: return;
           }
       }
       
      Returns:
      The name of the updated property
    • getEntity

      @Nonnull E getEntity()
      The affected entity
      Returns:
      The affected entity
    • getOldValue

      @Nullable T getOldValue()
      The old value
      Returns:
      The old value
    • getNewValue

      @Nullable T getNewValue()
      The new value
      Returns:
      The new value