public static class Parm.Opt
extends java.lang.Object
It is intended that this base class be extended with custom fields (and even methods if needed) according to the program requirements.
This also serves to supply the initialization methods to populate the options and afterwards invoke the custom run time routines that process based on these options.
| Modifier and Type | Field and Description |
|---|---|
boolean |
bHelp
Trigger dump of options when true.
|
java.lang.String |
sBrief
Fully qualified name of Brief file.
|
| Constructor and Description |
|---|
Opt() |
| Modifier and Type | Method and Description |
|---|---|
void |
addProp(java.lang.String sProp)
Parse and add property string.
|
java.lang.String |
getProp(java.lang.String sKey)
Return property value for
sKey or null; |
java.lang.String |
getProp(java.lang.String sKey,
java.lang.String sDef)
Return property value for
sKey or sDef; |
java.lang.String[] |
getProps()
Return an array of property value names;
|
boolean |
isTrue(java.lang.String sProp)
Return whether a property value represents
true. |
void |
mainStart(Parm[] oParms,
java.lang.String[] sArgs,
Parm.MainRun oRun)
The
mainStart method handles the standard startup and termination procedures. |
void |
selfIntro(java.lang.Object self)
Print to System.out standard introductory line.
|
void |
setBrief(Parm.Brief oBrief)
Set the internal
oBrief value to paramater oBrief value. |
public boolean bHelp
public java.lang.String sBrief
setBrief method.public void addProp(java.lang.String sProp)
-def,
the sProp string is split on the first equal sign (=), the left being the name and the right being the value.
Multiple values are permitted. The last silently replaces the former.
Inproperly formatted strings are silently ignored.
sProp - the property string.public void selfIntro(java.lang.Object self)
self parameter is used to
determine the class.self - The class to which this message applies.public java.lang.String getProp(java.lang.String sKey)
sKey or null;sKey - The case sensitive property name.public java.lang.String getProp(java.lang.String sKey,
java.lang.String sDef)
sKey or sDef;sKey - The case sensitive property name.sDef - The default value to return if sKey does not exist.public java.lang.String[] getProps()
public boolean isTrue(java.lang.String sProp)
true. A true value starts with "t", "T", "y" or "Y".sProp - The case sensitive property name.public void mainStart(Parm[] oParms, java.lang.String[] sArgs, Parm.MainRun oRun)
mainStart method handles the standard startup and termination procedures.
First the parameters are passed using processArguments.
If the parse fails or the bHelp flag is true, the printHelp method is called and the run terminates.
Otherwise the run method is called.
When the run method returns and the internal oBrief object populated by the setBrief
method call is populated, it is transformed to a JSON object using GsonBuilder and written to the file specified by sBrief.
Finally, the run terminates.
oParms - The option table to parse.sArgs - The arguments to match.oRun - The MainRun mainline instance on which to invoke the run method.public void setBrief(Parm.Brief oBrief) throws java.lang.Exception
oBrief value to paramater oBrief value.
The internal sBrief value must be populated or an Exception occurs.
If the physical files exists it is deleted. This means that at the end of the run the external routines can know that the non-existance of the Brief file implies a run failure.
For this protcol to work reliably, this method call should be issued at the beginning of the run invokation.
oBrief - The Brief extended instance.java.lang.Exception