Class FolderConfigItemChange<T>

java.lang.Object
tech.guilhermekaua.spigotboot.config.folder.FolderConfigItemChange<T>
Type Parameters:
T - the item type

public final class FolderConfigItemChange<T> extends Object
Represents a change to a folder config item.

This class captures all information about a single item change: what folder config it belongs to, what type of change occurred, and the before/after values.

  • Constructor Details

    • FolderConfigItemChange

      public FolderConfigItemChange(@NotNull @NotNull String folderConfigName, @NotNull @NotNull Class<T> itemType, @NotNull @NotNull String id, @NotNull @NotNull ItemChangeType type, @Nullable T oldItem, @Nullable T newItem)
      Creates a new folder config item change.
      Parameters:
      folderConfigName - the folder config name
      itemType - the item type class
      id - the item ID
      type - the type of change
      oldItem - the old item (null for ADDED)
      newItem - the new item (null for REMOVED)
  • Method Details

    • added

      public static <T> FolderConfigItemChange<T> added(@NotNull @NotNull String folderConfigName, @NotNull @NotNull Class<T> itemType, @NotNull @NotNull String id, @NotNull T newItem)
      Creates an ADDED change.
      Type Parameters:
      T - the item type
      Parameters:
      folderConfigName - the folder config name
      itemType - the item type class
      id - the item ID
      newItem - the new item
      Returns:
      the change
    • modified

      public static <T> FolderConfigItemChange<T> modified(@NotNull @NotNull String folderConfigName, @NotNull @NotNull Class<T> itemType, @NotNull @NotNull String id, @NotNull T oldItem, @NotNull T newItem)
      Creates a MODIFIED change.
      Type Parameters:
      T - the item type
      Parameters:
      folderConfigName - the folder config name
      itemType - the item type class
      id - the item ID
      oldItem - the old item
      newItem - the new item
      Returns:
      the change
    • removed

      public static <T> FolderConfigItemChange<T> removed(@NotNull @NotNull String folderConfigName, @NotNull @NotNull Class<T> itemType, @NotNull @NotNull String id, @NotNull T oldItem)
      Creates a REMOVED change.
      Type Parameters:
      T - the item type
      Parameters:
      folderConfigName - the folder config name
      itemType - the item type class
      id - the item ID
      oldItem - the removed item
      Returns:
      the change
    • getFolderConfigName

      @NotNull public @NotNull String getFolderConfigName()
      Gets the folder config name.
      Returns:
      the folder config name
    • getItemType

      @NotNull public @NotNull Class<T> getItemType()
      Gets the item type class.
      Returns:
      the item type
    • getId

      @NotNull public @NotNull String getId()
      Gets the item ID.
      Returns:
      the item ID
    • getType

      @NotNull public @NotNull ItemChangeType getType()
      Gets the type of change.
      Returns:
      the change type
    • getOldItem

      @Nullable public T getOldItem()
      Gets the old item value.
      Returns:
      the old item, or null for ADDED changes
    • getNewItem

      @Nullable public T getNewItem()
      Gets the new item value.
      Returns:
      the new item, or null for REMOVED changes
    • toString

      public String toString()
      Overrides:
      toString in class Object