Class AbstractObjectExporter
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.visualization.debug.objectexport.AbstractObjectExporter
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,FileFormatHandler
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
ImageExporter
,PlainTextExporter
,PropertiesExporter
,RenderedPlainTextExporter
,ReportExporter
,SerializableObjectExporter
,SpreadSheetExporter
,TimeseriesExporter
,WekaInstancesExporter
public abstract class AbstractObjectExporter extends AbstractOptionHandler implements FileFormatHandler
Ancestor for classes that can export certain objects to files.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static Class[]
m_ExporterClasses
the exporters (classes) currently available.protected static String[]
m_Exporters
the exporters (classnames) currently available.-
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 AbstractObjectExporter()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract String
doExport(Object obj, File file)
Performs the actual export.String
export(Object obj, File file)
Exports the object.String
getDefaultFormatExtension()
Returns the default extension of the format.static String[]
getExporters()
Returns a list with classnames of exporters.static List<AbstractObjectExporter>
getExporters(Class cls)
Returns a exporters for the specified class.static List<AbstractObjectExporter>
getExporters(Class cls, Class[] excluded)
Returns a exporters for the specified class.static List<AbstractObjectExporter>
getExporters(Object obj)
Returns a exporters for the specified object.static List<AbstractObjectExporter>
getExporters(Object obj, Class[] excluded)
Returns a exporters for the specified object.abstract String
getFormatDescription()
Returns a string describing the format (used in the file chooser).abstract String[]
getFormatExtensions()
Returns the extension(s) of the format.String
globalInfo()
Returns a string describing the object.abstract boolean
handles(Class cls)
Checks whether the exporter can handle the specified class.protected static void
initExporters()
Initializes the exporters.protected static List<AbstractObjectExporter>
instantiate(List<Class> exporters)
Instantiates the exporters.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, 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
-
-
-
-
Method Detail
-
initExporters
protected static void initExporters()
Initializes the exporters.
-
getExporters
public static List<AbstractObjectExporter> getExporters(Object obj)
Returns a exporters for the specified object.- Parameters:
obj
- the object to get a commandline exporter for- Returns:
- the exporters
-
getExporters
public static List<AbstractObjectExporter> getExporters(Object obj, Class[] excluded)
Returns a exporters for the specified object.- Parameters:
obj
- the object to get a commandline exporter forexcluded
- the exporters to exclude, ignored if null- Returns:
- the exporters
-
getExporters
public static List<AbstractObjectExporter> getExporters(Class cls)
Returns a exporters for the specified class.- Parameters:
cls
- the class to get a commandline exporter for- Returns:
- the exporters
-
getExporters
public static List<AbstractObjectExporter> getExporters(Class cls, Class[] excluded)
Returns a exporters for the specified class.- Parameters:
cls
- the class to get a commandline exporter forexcluded
- the exporters to exclude, ignored if null- Returns:
- the exporters
-
instantiate
protected static List<AbstractObjectExporter> instantiate(List<Class> exporters)
Instantiates the exporters.- Parameters:
exporters
- the exporters to instantiate- Returns:
- the instances
-
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
-
getFormatDescription
public abstract String getFormatDescription()
Returns a string describing the format (used in the file chooser).- Specified by:
getFormatDescription
in interfaceFileFormatHandler
- Returns:
- a description suitable for displaying in the file chooser
-
getFormatExtensions
public abstract String[] getFormatExtensions()
Returns the extension(s) of the format.- Specified by:
getFormatExtensions
in interfaceFileFormatHandler
- Returns:
- the extension (without the dot!)
-
getDefaultFormatExtension
public String getDefaultFormatExtension()
Returns the default extension of the format.- Specified by:
getDefaultFormatExtension
in interfaceFileFormatHandler
- Returns:
- the default extension (without the dot!)
-
handles
public abstract boolean handles(Class cls)
Checks whether the exporter can handle the specified class.- Parameters:
cls
- the class to check- Returns:
- true if the exporter can handle this type of object
-
doExport
protected abstract String doExport(Object obj, File file)
Performs the actual export.- Parameters:
obj
- the object to exportfile
- the file to export to- Returns:
- null if successful, otherwise error message
-
export
public String export(Object obj, File file)
Exports the object.- Parameters:
obj
- the object to exportfile
- the file to export to- Returns:
- null if successful, otherwise error message
-
getExporters
public static String[] getExporters()
Returns a list with classnames of exporters.- Returns:
- the exporter classnames
-
-