Package adams.data.io.output
Class AbstractSimpleReportWriter<T extends Report>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.io.output.AbstractReportWriter<T>
-
- adams.data.io.output.AbstractSimpleReportWriter<T>
-
- Type Parameters:
T- the type of report to handle
- All Implemented Interfaces:
CleanUpHandler,Destroyable,GlobalInfoSupporter,FileFormatHandler,LoggingLevelHandler,LoggingSupporter,OptionHandler,ShallowCopySupporter<AbstractReportWriter>,SizeOfHandler,ReportWriter<T>,StringReportWriter<T>,Serializable,Comparable
- Direct Known Subclasses:
DefaultSimpleReportWriter
public abstract class AbstractSimpleReportWriter<T extends Report> extends AbstractReportWriter<T> implements StringReportWriter<T>
Abstract ancestor for writing reports in properties format.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class adams.data.io.output.AbstractReportWriter
m_Output
-
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 AbstractSimpleReportWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetFormatDescription()Returns a string describing the format (used in the file chooser).String[]getFormatExtensions()Returns the extension(s) of the format.StringglobalInfo()Returns a string describing the object.protected String[]toLines(T data)Turns the data into an array of strings (sorted field names).Stringwrite(T data, MessageCollection errors)Performs checks and converts the report to a string.protected booleanwriteData(T data)Performs the actual writing.-
Methods inherited from class adams.data.io.output.AbstractReportWriter
checkData, cleanUp, compareTo, defineOptions, destroy, equals, forCommandLine, forName, getDefaultFormatExtension, getOutput, getWriters, outputTipText, reset, setOutput, shallowCopy, shallowCopy, write
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.data.io.output.ReportWriter
getOutput, outputTipText, setOutput, write
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
getFormatDescription
public String getFormatDescription()
Returns a string describing the format (used in the file chooser).- Specified by:
getFormatDescriptionin interfaceFileFormatHandler- Specified by:
getFormatDescriptionin classAbstractReportWriter<T extends Report>- Returns:
- a description suitable for displaying in the file chooser
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the extension(s) of the format.- Specified by:
getFormatExtensionsin interfaceFileFormatHandler- Specified by:
getFormatExtensionsin classAbstractReportWriter<T extends Report>- Returns:
- the extension(s) (without the dot!)
-
toLines
protected String[] toLines(T data) throws Exception
Turns the data into an array of strings (sorted field names).- Parameters:
data- the data to convert- Returns:
- the generated string array
- Throws:
Exception- if conversion fails
-
writeData
protected boolean writeData(T data)
Performs the actual writing.- Specified by:
writeDatain classAbstractReportWriter<T extends Report>- Parameters:
data- the data to write- Returns:
- true if successfully written
-
write
public String write(T data, MessageCollection errors)
Performs checks and converts the report to a string.- Specified by:
writein interfaceStringReportWriter<T extends Report>- Parameters:
data- the data to writeerrors- for collecting errors- Returns:
- the generated data, null in case of failure
-
-