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 String
KEY_CLASS
the key for the class name.static String
KEY_OPTIONS
the 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 String
getDefaultFormatExtension()
Returns the default file extension (without the dot).String
getFormatDescription()
Returns the description of the file format.String[]
getFormatExtensions()
Returns the file extensions (without the dot).String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.protected net.minidev.json.JSONObject
initOutput()
Initializes the output data structure.static void
main(String[] args)
Executes the producer from commandline.protected net.minidev.json.JSONObject
newObject(Object obj)
Creates a new JSON object.protected void
preProduce()
Hook-method before starting visiting options.Object
processOption(AbstractArgumentOption option)
Visits an argument option.Object
processOption(BooleanOption option)
Visits a boolean option.Object
processOption(ClassOption option)
Visits a class option.String
toString()
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:
globalInfo
in interfaceOptionProducer<net.minidev.json.JSONObject,Object>
- Specified by:
globalInfo
in classAbstractOptionProducer<net.minidev.json.JSONObject,Object>
- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractOptionProducer<net.minidev.json.JSONObject,Object>
-
initOutput
protected net.minidev.json.JSONObject initOutput()
Initializes the output data structure.- Specified by:
initOutput
in 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:
processOption
in interfaceOptionProducer<net.minidev.json.JSONObject,Object>
- Specified by:
processOption
in 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:
processOption
in interfaceOptionProducer<net.minidev.json.JSONObject,Object>
- Specified by:
processOption
in 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:
processOption
in interfaceOptionProducer<net.minidev.json.JSONObject,Object>
- Specified by:
processOption
in 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:
toString
in interfaceOptionProducer<net.minidev.json.JSONObject,Object>
- Specified by:
toString
in 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:
preProduce
in classAbstractOptionProducer<net.minidev.json.JSONObject,Object>
- See Also:
AbstractOptionProducer.initOutput()
-
getFormatDescription
public String getFormatDescription()
Returns the description of the file format.- Specified by:
getFormatDescription
in interfaceFileFormatHandler
- Returns:
- the description
-
getDefaultFormatExtension
public String getDefaultFormatExtension()
Returns the default file extension (without the dot).- Specified by:
getDefaultFormatExtension
in interfaceFileFormatHandler
- Returns:
- the default extension
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the file extensions (without the dot).- Specified by:
getFormatExtensions
in 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
-
-