Class SuggestedFilenameGenerator

java.lang.Object
net.sf.basedb.util.bfs.AbstractFilenameGenerator<Object>
net.sf.basedb.util.bfs.SuggestedFilenameGenerator
All Implemented Interfaces:
FilenameGenerator<Object>

public class SuggestedFilenameGenerator extends AbstractFilenameGenerator<Object>
File name generator implementation that uses the suggested file name. The implementation returns the suggested file name after making sure that it is unique. Non-unique suggestions are transformed with a simple algorithm that adds a sequence number to the file name. Eg. if the file name 'example.txt' is suggested three times, this generator will return 'example.txt', 'example-2.txt', 'example-3.txt'.
Version:
2.15
Author:
Nicklas
Last modified
$Date: 2010-01-12 14:21:49 +0100 (ti, 12 jan 2010) $
  • Constructor Details

    • SuggestedFilenameGenerator

      public SuggestedFilenameGenerator()
  • Method Details

    • getNextFilename

      public String getNextFilename(Object owner, String suggestedFilename)
      Description copied from interface: FilenameGenerator
      Get the next file name. This method should never return the same file name more than one time (given a single implementor instance). The generator implementation should not concern itself with the underlying file system or if the file already exists or not (this is a task for the DataWriterFactory implementation).
      Parameters:
      owner - The owner of the data in the file
      suggestedFilename - A default suggested file name (can be null)
      Returns:
      A unique file name