Package adams.core.option
Class JavaInstantiationProducer
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.option.AbstractOptionProducer<O,I>
-
- adams.core.option.AbstractRecursiveOptionProducer<O,I>
-
- adams.core.option.AbstractRecursiveOptionProducerWithOptionHandling<String,String>
-
- adams.core.option.AbstractJavaCodeProducer
-
- adams.core.option.JavaInstantiationProducer
-
- All Implemented Interfaces:
CleanUpHandler,Destroyable,FileFormatHandler,LoggingSupporter,OptionHandler,OptionProducer<String,String>,OptionProducerWithOptionHandling<String,String>,RecursiveOptionProducer,SizeOfHandler,Serializable
public class JavaInstantiationProducer extends AbstractJavaCodeProducer implements FileFormatHandler
Generates Java code for instantiating the object.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class adams.core.option.AbstractJavaCodeProducer
JAVA_KEYWORDS, m_AdditionalImportsInsertLocation, m_Copyright, m_Indentation, m_JavaKeywords, m_OutputBuffer, m_OutputDefaultValues, m_Package, m_ShortenedImports, m_SimpleName, m_VarNames
-
Fields inherited from class adams.core.option.AbstractRecursiveOptionProducerWithOptionHandling
m_OptionManager
-
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 JavaInstantiationProducer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddMainMethod()Hook method for adding a main method.protected voidaddMethodEnd()Closes the method with the generated code.protected voidaddMethodStart()Adds the method that encloses the generated code.voiddefineOptions()Adds options to the internal list of options.StringgetDefaultFormatExtension()Returns the default file extension (without the dot).StringgetFormatDescription()Returns a string describing the format (used in the file chooser).String[]getFormatExtensions()Returns the file extensions (without the dot).protected StringgetIndentation()Returns the indentation for code inside the try-catch-block.protected StringgetOuterVariableName()The outer most variable name.StringgetPackage()Returns the package name to use.StringgetSimpleName()Returns the simple name to use.StringglobalInfo()Returns a string describing the object.static voidmain(String[] args)Executes the producer from commandline.voidsetPackage(String value)Sets the package name of the class to generate.voidsetSimpleName(String value)Sets the simple name (without package) of the class to generate.-
Methods inherited from class adams.core.option.AbstractJavaCodeProducer
addAdditionalMethods, addClassEnd, addClassJavadoc, addClassStart, addConstructor, addCopyright, addImports, addLicensePreamble, addPackage, copyrightTipText, escapeDoubleQuotes, getCast, getClassname, getClassname, getClassname, getCopyright, getCurrentVariable, getNextTmpVariable, getNextTmpVariable, getNextTmpVariable, getOutput, getOutputDefaultValues, getRequiredImports, initialize, initOutput, insertAdditionalImports, isClassName, outputDefaultValuesTipText, packageTipText, postIndent, postProduce, preIndent, preProduce, preProduce, processClassOption, processOption, processOption, processOption, setCopyright, setOutputDefaultValues, shortenClassname, simpleNameTipText, toString
-
Methods inherited from class adams.core.option.AbstractRecursiveOptionProducerWithOptionHandling
cleanUpOptions, destroy, finishInit, getOptionManager, newOptionManager, toCommandLine
-
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, getOutputVariableValues, getSkippedProperties, getUsePropertyNames, isDefaultValue, loggingLevelTipText, outputVariableValuesTipText, postProduce, 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
cleanUp, doProduce, getInput, getLoggingLevel, getOutputVariableValues, getSkippedProperties, getUsePropertyNames, loggingLevelTipText, outputVariableValuesTipText, produce, setLoggingLevel, setOutputVariableValues, setSkippedProperties, write
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceOptionProducer<String,String>- Specified by:
globalInfoin classAbstractOptionProducer<String,String>- 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- Returns:
- a description suitable for displaying in the file chooser
-
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
-
defineOptions
public void defineOptions()
Adds options to the internal list of options. Derived classes must override this method to add additional options.- Specified by:
defineOptionsin interfaceOptionHandler- Specified by:
defineOptionsin interfaceOptionProducerWithOptionHandling<String,String>- Overrides:
defineOptionsin classAbstractJavaCodeProducer
-
setSimpleName
public void setSimpleName(String value)
Sets the simple name (without package) of the class to generate.- Overrides:
setSimpleNamein classAbstractJavaCodeProducer- Parameters:
value- the simple name
-
getSimpleName
public String getSimpleName()
Returns the simple name to use.- Overrides:
getSimpleNamein classAbstractJavaCodeProducer- Returns:
- the simple name
-
setPackage
public void setPackage(String value)
Sets the package name of the class to generate.- Overrides:
setPackagein classAbstractJavaCodeProducer- Parameters:
value- the package name
-
getPackage
public String getPackage()
Returns the package name to use.- Overrides:
getPackagein classAbstractJavaCodeProducer- Returns:
- the package name
-
getOuterVariableName
protected String getOuterVariableName()
The outer most variable name.- Specified by:
getOuterVariableNamein classAbstractJavaCodeProducer- Returns:
- the variable name
-
getIndentation
protected String getIndentation()
Returns the indentation for code inside the try-catch-block.- Specified by:
getIndentationin classAbstractJavaCodeProducer- Returns:
- the indentation string
-
addMethodStart
protected void addMethodStart()
Adds the method that encloses the generated code.- Specified by:
addMethodStartin classAbstractJavaCodeProducer
-
addMethodEnd
protected void addMethodEnd()
Closes the method with the generated code.- Specified by:
addMethodEndin classAbstractJavaCodeProducer
-
addMainMethod
protected void addMainMethod()
Hook method for adding a main method.
Default implementation merely instantiates a new instance of the class.- Overrides:
addMainMethodin classAbstractJavaCodeProducer
-
main
public static void main(String[] args)
Executes the producer from commandline.- Parameters:
args- the commandline arguments, use -help for help
-
-