Class AbstractNotesWriter
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.tools.previewbrowser.notes.AbstractNotesWriter
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,FileFormatHandler
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
CsvNotesWriter
,JsonNotesWriter
,PropertiesNotesWriter
,YamlNotesWriter
public abstract class AbstractNotesWriter extends AbstractOptionHandler implements FileFormatHandler
Ancestor for notes writers.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
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 AbstractNotesWriter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected String
check(Map<String,String> notes, PlaceholderFile file)
Hook method for checks before writing the notes.protected abstract String
doWrite(Map<String,String> notes, PlaceholderFile file)
Writes the notes to the specified file.abstract AbstractNotesReader
getCorrespondingReader()
Returns the corresponding reader.protected abstract String
getDefaultFileName()
Returns the default file name for the notes file.protected List<String>
getSortedFiles(Map<String,String> notes)
Sorts the files (keys) and returns them as list.String
write(Map<String,String> notes, PlaceholderDirectory dir)
Writes the notes to the specified directory.String
write(Map<String,String> notes, PlaceholderFile file)
Writes the notes to the specified file.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, 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.io.FileFormatHandler
getDefaultFormatExtension, getFormatDescription, getFormatExtensions
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Method Detail
-
getDefaultFileName
protected abstract String getDefaultFileName()
Returns the default file name for the notes file.- Returns:
- the name, no path
-
getCorrespondingReader
public abstract AbstractNotesReader getCorrespondingReader()
Returns the corresponding reader.- Returns:
- the reader, null if not available
-
check
protected String check(Map<String,String> notes, PlaceholderFile file)
Hook method for checks before writing the notes.- Parameters:
notes
- the notes to writefile
- the file to store the notes in- Returns:
- null if checks passed, otherwise error message
-
getSortedFiles
protected List<String> getSortedFiles(Map<String,String> notes)
Sorts the files (keys) and returns them as list.- Parameters:
notes
- the notes to get the files/keys from- Returns:
- the sorted files/keys
-
doWrite
protected abstract String doWrite(Map<String,String> notes, PlaceholderFile file)
Writes the notes to the specified file.- Parameters:
notes
- the notes to writefile
- the file to store the notes in- Returns:
- null if successfully written, otherwise error message
-
write
public String write(Map<String,String> notes, PlaceholderDirectory dir)
Writes the notes to the specified directory. Uses the default notes name.- Parameters:
notes
- the notes to writedir
- the directory to store the notes in- Returns:
- null if successfully written, otherwise error message
- See Also:
getDefaultFileName()
-
write
public String write(Map<String,String> notes, PlaceholderFile file)
Writes the notes to the specified file.- Parameters:
notes
- the notes to writefile
- the file to store the notes in- Returns:
- null if successfully written, otherwise error message
-
-