Class FileRegistry
java.lang.Object
io.github.monsieurdoceo.filizer.storage.infrastructure.FileRegistry
Maintains the registry of managed files.
Stores, retrieves, and removes CustomFile
instances using their normalized file paths.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(CustomFile customFile) Stores the givenCustomFileif it is not already present.booleancontains(CustomFile customFile) Checks whether a file with the givenCustomFileexists in storage.Retrieves aCustomFileby its path.Retrieves aCustomFileby its absolute path.findByName(String name) Retrieves everyCustomFilematching the provided name.getFiles()Retrieves all storedCustomFileinstances.voidremove(CustomFile customFile) Remove the givenCustomFilefrom storage.voidRemoves theCustomFileassociated by the given name.voidRemoves theCustomFileassociated by the given path.
-
Constructor Details
-
FileRegistry
public FileRegistry()Initializes a new file registry instance.No custom initialization is required.
-
-
Method Details
-
contains
Checks whether a file with the givenCustomFileexists in storage.- Parameters:
customFile- the file to search for- Returns:
trueif file exists, otherwisefalse
-
add
Stores the givenCustomFileif it is not already present.- Parameters:
customFile- the file to store
-
remove
Removes theCustomFileassociated by the given name.- Parameters:
name- of the file to remove
-
remove
Removes theCustomFileassociated by the given path.- Parameters:
path- of the file to remove
-
remove
Remove the givenCustomFilefrom storage.This method behaves like
remove(String)but operates directly on aCustomFileinstance.- Parameters:
customFile- the file to remove
-
find
Retrieves aCustomFileby its absolute path.- Parameters:
path- the file path- Returns:
- the matching file, if present
-
find
Retrieves aCustomFileby its path.- Parameters:
file- the file- Returns:
- the matching file, if present
-
findByName
Retrieves everyCustomFilematching the provided name.- Parameters:
name- the file name- Returns:
- all matching files
-
getFiles
Retrieves all storedCustomFileinstances.- Returns:
- a collection containing all stored files
-