Package adams.core.option
Class JsonClassDescriptionProducer
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.option.AbstractOptionProducer<O,I>
-
- adams.core.option.AbstractRecursiveOptionProducer<net.minidev.json.JSONObject,Object>
-
- adams.core.option.JsonClassDescriptionProducer
-
- All Implemented Interfaces:
CleanUpHandler,FileFormatHandler,LoggingSupporter,OptionProducer<net.minidev.json.JSONObject,Object>,RecursiveOptionProducer,SizeOfHandler,Serializable
public class JsonClassDescriptionProducer extends AbstractRecursiveOptionProducer<net.minidev.json.JSONObject,Object> implements FileFormatHandler
Generates a description of the class and its options in JSON format.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringKEY_CLASSthe key for the class name.static StringKEY_OPTIONSthe key for the options.-
Fields inherited from class adams.core.option.AbstractRecursiveOptionProducer
m_Nesting
-
Fields inherited from class adams.core.option.AbstractOptionProducer
m_Input, m_LastGenerated, m_Output, m_OutputVariableValues, m_SkippedProperties, m_UsePropertyNames
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description JsonClassDescriptionProducer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDefaultFormatExtension()Returns the default file extension (without the dot).StringgetFormatDescription()Returns the description of the file format.String[]getFormatExtensions()Returns the file extensions (without the dot).StringglobalInfo()Returns a string describing the object.protected voidinitialize()Initializes the members.protected net.minidev.json.JSONObjectinitOutput()Initializes the output data structure.static voidmain(String[] args)Executes the producer from commandline.protected net.minidev.json.JSONObjectnewObject(Object obj)Creates a new JSON object.protected voidpreProduce()Hook-method before starting visiting options.ObjectprocessOption(AbstractArgumentOption option)Visits an argument option.ObjectprocessOption(BooleanOption option)Visits a boolean option.ObjectprocessOption(ClassOption option)Visits a class option.StringtoString()Returns the output generated from the visit.-
Methods inherited from class adams.core.option.AbstractRecursiveOptionProducer
cleanUp, generateLoggingString, getDebugIndentation, getDebugIndentation, getRecursionLevel, reset
-
Methods inherited from class adams.core.option.AbstractOptionProducer
checkInput, doProduce, doProduce, getCurrentValue, getInput, getOptionIdentifier, getOutput, getOutputVariableValues, getSkippedProperties, getUsePropertyNames, isDefaultValue, loggingLevelTipText, outputVariableValuesTipText, postProduce, postProduce, preProduce, produce, produce, runProducer, setLoggingLevel, setOutputVariableValues, setSkippedProperties, toString, write
-
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.option.OptionProducer
getLoggingLevel
-
-
-
-
Field Detail
-
KEY_CLASS
public static final String KEY_CLASS
the key for the class name.- See Also:
- Constant Field Values
-
KEY_OPTIONS
public static final String KEY_OPTIONS
the key for the options.- See Also:
- Constant Field Values
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceOptionProducer<net.minidev.json.JSONObject,Object>- Specified by:
globalInfoin classAbstractOptionProducer<net.minidev.json.JSONObject,Object>- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classAbstractOptionProducer<net.minidev.json.JSONObject,Object>
-
initOutput
protected net.minidev.json.JSONObject initOutput()
Initializes the output data structure.- Specified by:
initOutputin classAbstractOptionProducer<net.minidev.json.JSONObject,Object>- Returns:
- the created data structure
-
newObject
protected net.minidev.json.JSONObject newObject(Object obj)
Creates a new JSON object.- Parameters:
obj- the object to add to a JSONObject structure- Returns:
- the JSON object
-
processOption
public Object processOption(BooleanOption option)
Visits a boolean option.- Specified by:
processOptionin interfaceOptionProducer<net.minidev.json.JSONObject,Object>- Specified by:
processOptionin classAbstractOptionProducer<net.minidev.json.JSONObject,Object>- Parameters:
option- the boolean option- Returns:
- always null
-
processOption
public Object processOption(ClassOption option)
Visits a class option.- Specified by:
processOptionin interfaceOptionProducer<net.minidev.json.JSONObject,Object>- Specified by:
processOptionin classAbstractOptionProducer<net.minidev.json.JSONObject,Object>- Parameters:
option- the class option- Returns:
- always null
-
processOption
public Object processOption(AbstractArgumentOption option)
Visits an argument option.- Specified by:
processOptionin interfaceOptionProducer<net.minidev.json.JSONObject,Object>- Specified by:
processOptionin classAbstractOptionProducer<net.minidev.json.JSONObject,Object>- Parameters:
option- the argument option- Returns:
- always null
-
toString
public String toString()
Returns the output generated from the visit.- Specified by:
toStringin interfaceOptionProducer<net.minidev.json.JSONObject,Object>- Specified by:
toStringin classAbstractOptionProducer<net.minidev.json.JSONObject,Object>- Returns:
- the output, null in case of an error
-
preProduce
protected void preProduce()
Hook-method before starting visiting options.- Overrides:
preProducein classAbstractOptionProducer<net.minidev.json.JSONObject,Object>- See Also:
AbstractOptionProducer.initOutput()
-
getFormatDescription
public String getFormatDescription()
Returns the description of the file format.- Specified by:
getFormatDescriptionin interfaceFileFormatHandler- Returns:
- the description
-
getDefaultFormatExtension
public String getDefaultFormatExtension()
Returns the default file extension (without the dot).- Specified by:
getDefaultFormatExtensionin interfaceFileFormatHandler- Returns:
- the default extension
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the file extensions (without the dot).- Specified by:
getFormatExtensionsin interfaceFileFormatHandler- Returns:
- the extensions
-
main
public static void main(String[] args)
Executes the producer from commandline.- Parameters:
args- the commandline arguments, use -help for help
-
-