Interface FolderConfigEditor<T>
- Type Parameters:
T- the item type
- All Known Implementing Classes:
DefaultFolderConfigEditor
public interface FolderConfigEditor<T>
Editor interface for modifying a folder-based configuration.
All operations persist changes to disk and update the in-memory snapshot atomically. Listeners are notified of all changes.
-
Method Summary
Modifier and TypeMethodDescription@NotNull EditResult<T>Creates a new item in the folder config.@NotNull EditResult<Void>Deletes an item from the folder config.@NotNull EditResult<T>Saves (overwrites) an item in the folder config.@NotNull EditResult<T>update(@NotNull String id, @NotNull UnaryOperator<T> mutator) Updates an existing item in the folder config.
-
Method Details
-
create
Creates a new item in the folder config.- Parameters:
id- the item ID (will be used as filename without extension)value- the item value- Returns:
- the edit result
-
save
Saves (overwrites) an item in the folder config.If the item doesn't exist, it will be created.
- Parameters:
id- the item IDvalue- the new item value- Returns:
- the edit result
-
update
@NotNull @NotNull EditResult<T> update(@NotNull @NotNull String id, @NotNull @NotNull UnaryOperator<T> mutator) Updates an existing item in the folder config.The mutator receives a copy of the current item and should return the modified version. The original item is not modified.
- Parameters:
id- the item IDmutator- the function to apply to the item copy- Returns:
- the edit result
-
delete
Deletes an item from the folder config.- Parameters:
id- the item ID- Returns:
- the edit result (value is null for delete operations)
-