Package adams.core.io

Class TimestampFilenameGenerator

  • All Implemented Interfaces:
    Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, SizeOfHandler, Serializable

    public class TimestampFilenameGenerator
    extends SimpleFilenameGenerator
    Generator that assembles a filename based on output dir, prefix, current timestamp (according to format string), suffix and extension.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -dir <adams.core.io.PlaceholderDirectory> (property: directory)
        The parent directory of the generated filename.
        default: ${CWD}
     
    -extension <java.lang.String> (property: extension)
        The extension to use (including the dot).
        default: 
     
    -prefix <java.lang.String> (property: prefix)
        The prefix to use (before the object).
        default: 
     
    -suffix <java.lang.String> (property: suffix)
        The suffix to use (after the object).
        default: 
     
    -format <adams.data.DateFormatString> (property: format)
        The format of the timestamp to generate.
        default: yyyy-MM-dd HH:mm:ss
        more: http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Formatter

        protected transient DateFormat m_Formatter
        for generating the timestamp.
    • Constructor Detail

      • TimestampFilenameGenerator

        public TimestampFilenameGenerator()
    • Method Detail

      • getFormatter

        protected DateFormat getFormatter()
        Returns the instance of a date formatter to use.
        Returns:
        the formatter object
      • getDefaultFormat

        protected DateFormatString getDefaultFormat()
        Returns the default format to use.
        Returns:
        the format
      • setFormat

        public void setFormat​(DateFormatString value)
        Sets the format string to use.
        Parameters:
        value - the format
      • getFormat

        public DateFormatString getFormat()
        Returns the format string in use.
        Returns:
        the format
      • formatTipText

        public String formatTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • doGenerate

        protected String doGenerate​(Object obj)
        Performs the actual generation of the filename.
        Overrides:
        doGenerate in class SimpleFilenameGenerator
        Parameters:
        obj - the object to generate the filename for
        Returns:
        the generated filename