Class FolderConfigEntry<T>

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

public final class FolderConfigEntry<T> extends Object
Internal entry holding folder config state for DefaultConfigManager.

Each FolderConfigEntry manages one folder-based folder config.

  • Constructor Details

    • FolderConfigEntry

      public FolderConfigEntry(@NotNull @NotNull Class<T> itemType, @NotNull @NotNull FolderConfig annotation, @NotNull @NotNull BootPlugin plugin, @NotNull @NotNull YamlConfigLoader loader, @NotNull @NotNull Binder binder, @NotNull @NotNull NamingStrategy namingStrategy)
      Creates a new folder config entry.
      Parameters:
      itemType - the item type class
      annotation - the @FolderConfig annotation
      plugin - the owning plugin
      loader - the YAML loader
      binder - the config binder
      namingStrategy - the naming strategy for field to config key conversion
  • Method Details

    • getItemType

      @NotNull public @NotNull Class<T> getItemType()
    • getFolderConfigName

      @NotNull public @NotNull String getFolderConfigName()
    • getFolder

      @NotNull public @NotNull Path getFolder()
    • getRef

      @NotNull public @NotNull DefaultFolderConfigRef<T> getRef()
    • getItemNode

      @Nullable public @Nullable ConfigNode getItemNode(@NotNull @NotNull String itemId)
      Gets the raw config node for a specific item.
      Parameters:
      itemId - the item ID
      Returns:
      the raw config node, or null if item not found
    • getItemIds

      @NotNull public @NotNull Set<String> getItemIds()
      Gets all item IDs that have raw nodes.
      Returns:
      set of item IDs
    • initialize

      public void initialize()
    • prepareFolder

      public void prepareFolder()
    • loadAll

      public void loadAll()
      Loads all items from the folder with filename ordering.
    • loadRawNodesOnly

      @NotNull public @NotNull Map<String,ConfigNode> loadRawNodesOnly()
      Loads raw nodes from disk without binding them.

      Used when reference scanning needs to happen across all folder configs before determining binding order. After calling this, use getItemIds() and getItemNode(String) to access the nodes, then call bindFromLoadedNodes(List) to bind them.

      Returns:
      map of item ID to raw config node
    • bindFromLoadedNodes

      public void bindFromLoadedNodes(@NotNull @NotNull List<String> bindOrder)
      Binds items from already-loaded raw nodes in the specified order.

      Raw nodes must have been loaded via loadRawNodesOnly() first. If no raw nodes are loaded, this creates an empty snapshot.

      Parameters:
      bindOrder - the order in which to bind items
    • bindItem

      @Nullable public T bindItem(@NotNull @NotNull String id, @NotNull @NotNull ConfigNode node)
    • reloadItemRawNode

      public void reloadItemRawNode(@NotNull @NotNull String itemId)
      Reloads the raw node for a single item from disk.

      Used during reload propagation to update the raw node before rebinding.

      Parameters:
      itemId - the item ID
    • rebindItem

      public void rebindItem(@NotNull @NotNull String itemId)
      Rebinds a single item from its raw node and updates the snapshot.

      The raw node must already be loaded. Used during reload propagation when only specific items need rebinding.

      Parameters:
      itemId - the item ID to rebind
    • reloadAll

      public void reloadAll()
      Reloads all items and computes changes.
    • reloadItem

      public void reloadItem(@NotNull @NotNull String id)
    • saveItem

      @NotNull public @NotNull EditResult<T> saveItem(@NotNull @NotNull String id, @NotNull T value)
      Saves an item to disk.
      Parameters:
      id - the item ID
      value - the item value
      Returns:
      the edit result
    • deleteItem

      @NotNull public @NotNull EditResult<Void> deleteItem(@NotNull @NotNull String id)
      Deletes an item from disk.
      Parameters:
      id - the item ID
      Returns:
      the edit result
    • copyItem

      @Nullable public T copyItem(@NotNull T item)
      Creates a copy of an item for safe mutation.
      Parameters:
      item - the item to copy
      Returns:
      the copy