Class FileNamerIndependent

Object
AnchorBean<FileNamer>
FileNamer
FileNamerIndependent
Direct Known Subclasses:
FromOutputName, LastDirectories, NormalizedPath, RegExMatcher, RelativeToDirectory

public abstract class FileNamerIndependent extends FileNamer
Base class for methods that derive the name independently for each file.

By independently, this means the name is derived using information from a particular file only, and not from the collective set of the files that are named together.

An exception may occur via the index, which is derived collectively from all files, but may be used in sub-classes.

Author:
Owen Feehan
  • Constructor Details

    • FileNamerIndependent

      public FileNamerIndependent()
  • Method Details

    • deriveName

      public List<NamedFile> deriveName(List<File> files, FileNamerContext context)
      Description copied from class: FileNamer
      Derives a list of names (associated with each file) for some files.
      Specified by:
      deriveName in class FileNamer
      Parameters:
      files - the files to describe.
      context - additional context for naming.
      Returns:
      a list of identical size and order to files, corresponding to the file the extracted name.
    • deriveName

      protected abstract String deriveName(File file, Optional<Path> inputDirectory, int index) throws CreateException
      Derives a unique name for this file.
      Parameters:
      file - the file.
      inputDirectory - the root input-directory used in naming.
      index - a unique incrementing number, beginning at zero, passed to each call to this method within a collection.
      Returns:
      the derived unique name.
      Throws:
      CreateException - if unable to create the unique name.