Package adams.core.option
Class AbstractSimpleOptionParser
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.option.AbstractSimpleOptionParser
-
- All Implemented Interfaces:
GlobalInfoSupporter
,LoggingSupporter
,SimpleOptionParser
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
AbstractClassPathAugmenter
,AbstractEnvironmentModifier
public abstract class AbstractSimpleOptionParser extends LoggingObject implements SimpleOptionParser
Ancestor for simple option parser objects.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractSimpleOptionParser()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SimpleOptionParser
forCommandline(String cmdline)
Instantiates the option parser from the commandline.net.sourceforge.argparse4j.inf.ArgumentParser
getParser()
Configures and returns the commandline parser.boolean
setOptions(String[] options)
Sets the commandline options.protected boolean
setOptions(net.sourceforge.argparse4j.inf.Namespace ns)
Sets the parsed options.-
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, toString, wait, wait, wait
-
Methods inherited from interface adams.core.GlobalInfoSupporter
globalInfo
-
-
-
-
Method Detail
-
getParser
public net.sourceforge.argparse4j.inf.ArgumentParser getParser()
Configures and returns the commandline parser.- Specified by:
getParser
in interfaceSimpleOptionParser
- Returns:
- the parser
-
setOptions
protected boolean setOptions(net.sourceforge.argparse4j.inf.Namespace ns)
Sets the parsed options.- Parameters:
ns
- the parsed options- Returns:
- if successfully set
-
setOptions
public boolean setOptions(String[] options) throws Exception
Sets the commandline options.- Specified by:
setOptions
in interfaceSimpleOptionParser
- Parameters:
options
- the options to use- Returns:
- true if successful
- Throws:
Exception
- in case of an invalid option
-
forCommandline
public static SimpleOptionParser forCommandline(String cmdline) throws Exception
Instantiates the option parser from the commandline.- Parameters:
cmdline
- the commandline to use- Returns:
- the instantiated object
- Throws:
Exception
- if instantiation/parsing fails
-
-