Package adams.data.io.output
Class PropertiesSpreadSheetWriter
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.io.output.AbstractSpreadSheetWriter
-
- adams.data.io.output.PropertiesSpreadSheetWriter
-
- All Implemented Interfaces:
AdditionalInformationHandler
,Destroyable
,GlobalInfoSupporter
,EncodingSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,SpreadSheetWriter
,Serializable
public class PropertiesSpreadSheetWriter extends AbstractSpreadSheetWriter
Outputs two columns (key and value) from a spreadsheet as Java properties file.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-key <adams.data.spreadsheet.SpreadSheetColumnIndex> (property: key) The column that acts as the key for the properties. default: 1 example: An index is a number starting with 1; column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.
-value <adams.data.spreadsheet.SpreadSheetColumnIndex> (property: value) The column that acts as the value for the properties. default: 2 example: An index is a number starting with 1; column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class adams.data.io.output.AbstractSpreadSheetWriter
AbstractSpreadSheetWriter.OutputType
-
-
Field Summary
Fields Modifier and Type Field Description protected SpreadSheetColumnIndex
m_Key
the column to use as key column.protected SpreadSheetColumnIndex
m_Value
the column to use as value column.-
Fields inherited from class adams.data.io.output.AbstractSpreadSheetWriter
m_Encoding, m_Stopped
-
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 PropertiesSpreadSheetWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defineOptions()
Adds options to the internal list of options.protected boolean
doWrite(SpreadSheet content, String filename)
Performs the actual writing.SpreadSheetReader
getCorrespondingReader()
Returns, if available, the corresponding reader.String
getFormatDescription()
Returns a string describing the format (used in the file chooser).String[]
getFormatExtensions()
Returns the extension(s) of the format.SpreadSheetColumnIndex
getKey()
Returns the column to act as key for properties.protected AbstractSpreadSheetWriter.OutputType
getOutputType()
Returns how the data is written.SpreadSheetColumnIndex
getValue()
Returns the column to act as value for properties.String
globalInfo()
Returns a string describing the object.String
keyTipText()
Returns the tip text for this property.void
setKey(SpreadSheetColumnIndex value)
Sets the column to act as key for properties.void
setValue(SpreadSheetColumnIndex value)
Sets the column to act as value for properties.String
valueTipText()
Returns the tip text for this property.-
Methods inherited from class adams.data.io.output.AbstractSpreadSheetWriter
canCompress, doWrite, doWrite, encodingTipText, getAdditionalInformation, getDefaultFormatExtension, getEncoding, getWriters, initialize, isStopped, preWriteFile, reset, setEncoding, stopExecution, supportsCompressedOutput, write, write, write, write
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_Key
protected SpreadSheetColumnIndex m_Key
the column to use as key column.
-
m_Value
protected SpreadSheetColumnIndex m_Value
the column to use as value column.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- 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 classAbstractOptionHandler
-
setKey
public void setKey(SpreadSheetColumnIndex value)
Sets the column to act as key for properties.- Parameters:
value
- the column
-
getKey
public SpreadSheetColumnIndex getKey()
Returns the column to act as key for properties.- Returns:
- the column
-
keyTipText
public String keyTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setValue
public void setValue(SpreadSheetColumnIndex value)
Sets the column to act as value for properties.- Parameters:
value
- the column
-
getValue
public SpreadSheetColumnIndex getValue()
Returns the column to act as value for properties.- Returns:
- the column
-
valueTipText
public String valueTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getCorrespondingReader
public SpreadSheetReader getCorrespondingReader()
Returns, if available, the corresponding reader.- Returns:
- the reader, null if none available
-
getFormatDescription
public String getFormatDescription()
Returns a string describing the format (used in the file chooser).- Specified by:
getFormatDescription
in interfaceSpreadSheetWriter
- Specified by:
getFormatDescription
in classAbstractSpreadSheetWriter
- Returns:
- a description suitable for displaying in the file chooser
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the extension(s) of the format.- Specified by:
getFormatExtensions
in interfaceSpreadSheetWriter
- Specified by:
getFormatExtensions
in classAbstractSpreadSheetWriter
- Returns:
- the extension (without the dot!)
-
getOutputType
protected AbstractSpreadSheetWriter.OutputType getOutputType()
Returns how the data is written.- Specified by:
getOutputType
in classAbstractSpreadSheetWriter
- Returns:
- the type
-
doWrite
protected boolean doWrite(SpreadSheet content, String filename)
Performs the actual writing.- Overrides:
doWrite
in classAbstractSpreadSheetWriter
- Parameters:
content
- the spreadsheet to writefilename
- the file to write the spreadsheet to- Returns:
- true if successfully written
-
-