Interface FolderConfigRef<T>
- Type Parameters:
T- the item type
- All Superinterfaces:
Supplier<FolderConfigSnapshot<T>>
- All Known Implementing Classes:
DefaultFolderConfigRef
A live reference to a folder-based configuration that updates on reload.
This is the primary injection type for folder configs. It provides access to the current snapshot, edit operations, and reload capabilities.
The underlying snapshot is swapped atomically on reload, so all reads
from a single get() call see a consistent state.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(@NotNull FolderConfigChangeListener<T> listener) Adds a listener for folder config changes.@NotNull FolderConfigEditor<T>edit()Gets an editor for modifying the folder config.@NotNull FolderConfigSnapshot<T>get()Gets the current snapshot of the folder config.@NotNull StringGets the folder config name.Gets the item type class.voidReloads the entire folder config from disk.voidreloadItem(@NotNull String id) Reloads a single item from disk.voidremoveListener(@NotNull FolderConfigChangeListener<T> listener) Removes a previously added listener.
-
Method Details
-
get
Gets the current snapshot of the folder config. -
edit
Gets an editor for modifying the folder config.The editor provides create/update/delete operations that persist to disk and update the in-memory snapshot atomically.
- Returns:
- the folder config editor
-
reloadAll
void reloadAll()Reloads the entire folder config from disk.This scans the folder, loads all matching files, and swaps the snapshot atomically. Listeners are notified of any changes.
-
reloadItem
Reloads a single item from disk.If the file no longer exists, the item is removed from the folder config. If this is a new file, the item is added. Listeners are notified.
- Parameters:
id- the item ID to reload
-
addListener
Adds a listener for folder config changes.- Parameters:
listener- the listener to add
-
removeListener
Removes a previously added listener.- Parameters:
listener- the listener to remove
-
getItemType
Gets the item type class.- Returns:
- the item class
-
getFolderConfigName
Gets the folder config name.- Returns:
- the folder config name
-