Class FolderConfigEntry<T>
java.lang.Object
tech.guilhermekaua.spigotboot.config.folder.FolderConfigEntry<T>
- Type Parameters:
T- the item type
Internal entry holding folder config state for DefaultConfigManager.
Each FolderConfigEntry manages one folder-based folder config.
-
Constructor Summary
ConstructorsConstructorDescriptionFolderConfigEntry(@NotNull Class<T> itemType, @NotNull FolderConfig annotation, @NotNull BootPlugin plugin, @NotNull YamlConfigLoader loader, @NotNull Binder binder, @NotNull NamingStrategy namingStrategy) Creates a new folder config entry. -
Method Summary
Modifier and TypeMethodDescriptionvoidbindFromLoadedNodes(@NotNull List<String> bindOrder) Binds items from already-loaded raw nodes in the specified order.bindItem(@NotNull String id, @NotNull ConfigNode node) Creates a copy of an item for safe mutation.@NotNull EditResult<Void>deleteItem(@NotNull String id) Deletes an item from disk.@NotNull Path@NotNull StringGets all item IDs that have raw nodes.@Nullable ConfigNodegetItemNode(@NotNull String itemId) Gets the raw config node for a specific item.@NotNull DefaultFolderConfigRef<T>getRef()voidvoidloadAll()Loads all items from the folder with filename ordering.@NotNull Map<String,ConfigNode> Loads raw nodes from disk without binding them.voidvoidrebindItem(@NotNull String itemId) Rebinds a single item from its raw node and updates the snapshot.voidReloads all items and computes changes.voidreloadItem(@NotNull String id) voidreloadItemRawNode(@NotNull String itemId) Reloads the raw node for a single item from disk.@NotNull EditResult<T>Saves an item to disk.
-
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 classannotation- the @FolderConfigannotationplugin- the owning pluginloader- the YAML loaderbinder- the config bindernamingStrategy- the naming strategy for field to config key conversion
-
-
Method Details
-
getItemType
-
getFolderConfigName
-
getFolder
-
getRef
-
getItemNode
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
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
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()andgetItemNode(String)to access the nodes, then callbindFromLoadedNodes(List)to bind them.- Returns:
- map of item ID to raw config node
-
bindFromLoadedNodes
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
-
reloadItemRawNode
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
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
-
saveItem
Saves an item to disk.- Parameters:
id- the item IDvalue- the item value- Returns:
- the edit result
-
deleteItem
Deletes an item from disk.- Parameters:
id- the item ID- Returns:
- the edit result
-
copyItem
Creates a copy of an item for safe mutation.- Parameters:
item- the item to copy- Returns:
- the copy
-