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 Summary
Fields Modifier and Type Field Description protected DateFormatString
m_Format
the format to use.protected DateFormat
m_Formatter
for generating the timestamp.-
Fields inherited from class adams.core.io.SimpleFilenameGenerator
m_Prefix, m_Suffix
-
Fields inherited from class adams.core.io.AbstractFilenameGeneratorWithExtension
m_Extension
-
Fields inherited from class adams.core.io.AbstractFilenameGeneratorWithDirectory
m_Directory
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description TimestampFilenameGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defineOptions()
Adds options to the internal list of options.protected String
doGenerate(Object obj)
Performs the actual generation of the filename.String
formatTipText()
Returns the tip text for this property.protected DateFormatString
getDefaultFormat()
Returns the default format to use.DateFormatString
getFormat()
Returns the format string in use.protected DateFormat
getFormatter()
Returns the instance of a date formatter to use.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.String
globalInfo()
Returns a string describing the object.void
setFormat(DateFormatString value)
Sets the format string to use.-
Methods inherited from class adams.core.io.SimpleFilenameGenerator
canHandleNullObject, getPrefix, getSuffix, prefixTipText, setPrefix, setSuffix, suffixTipText
-
Methods inherited from class adams.core.io.AbstractFilenameGeneratorWithExtension
extensionTipText, getExtension, setExtension
-
Methods inherited from class adams.core.io.AbstractFilenameGeneratorWithDirectory
directoryTipText, getDirectory, setDirectory
-
Methods inherited from class adams.core.io.AbstractFilenameGenerator
check, generate
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Format
protected DateFormatString m_Format
the format to use.
-
m_Formatter
protected transient DateFormat m_Formatter
for generating the timestamp.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Overrides:
globalInfo
in classSimpleFilenameGenerator
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classSimpleFilenameGenerator
-
getFormatter
protected DateFormat getFormatter()
Returns the instance of a date formatter to use.- Returns:
- the formatter object
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractFilenameGenerator
- Returns:
- null if no info available, otherwise short string
-
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 classSimpleFilenameGenerator
- Parameters:
obj
- the object to generate the filename for- Returns:
- the generated filename
-
-