java.lang.Object
io.github.monsieurdoceo.filizer.storage.infrastructure.FileRegistry

public final class FileRegistry extends Object
Maintains the registry of managed files.

Stores, retrieves, and removes CustomFile instances using their normalized file paths.

  • Constructor Details

    • FileRegistry

      public FileRegistry()
      Initializes a new file registry instance.

      No custom initialization is required.

  • Method Details

    • contains

      public boolean contains(CustomFile customFile)
      Checks whether a file with the given CustomFile exists in storage.
      Parameters:
      customFile - the file to search for
      Returns:
      true if file exists, otherwise false
    • add

      public void add(CustomFile customFile)
      Stores the given CustomFile if it is not already present.
      Parameters:
      customFile - the file to store
    • remove

      public void remove(String name)
      Removes the CustomFile associated by the given name.
      Parameters:
      name - of the file to remove
    • remove

      public void remove(Path path)
      Removes the CustomFile associated by the given path.
      Parameters:
      path - of the file to remove
    • remove

      public void remove(CustomFile customFile)
      Remove the given CustomFile from storage.

      This method behaves like remove(String) but operates directly on a CustomFile instance.

      Parameters:
      customFile - the file to remove
    • find

      public Optional<CustomFile> find(Path path)
      Retrieves a CustomFile by its absolute path.
      Parameters:
      path - the file path
      Returns:
      the matching file, if present
    • find

      public Optional<CustomFile> find(File file)
      Retrieves a CustomFile by its path.
      Parameters:
      file - the file
      Returns:
      the matching file, if present
    • findByName

      public Collection<CustomFile> findByName(String name)
      Retrieves every CustomFile matching the provided name.
      Parameters:
      name - the file name
      Returns:
      all matching files
    • getFiles

      public Collection<CustomFile> getFiles()
      Retrieves all stored CustomFile instances.
      Returns:
      a collection containing all stored files