public class CfgProperties extends BaseProperties
BaseProperties.LoadSettingsType
errMsgSetFlag, errorMessage, loadedCfgFname, SEPARATOR_STRING, SPECIAL_CHARS_STR
Constructor and Description |
---|
CfgProperties()
Creates an empty table of items.
|
CfgProperties(BaseProperties basePropObj)
Creates a properties object that uses the same table of items
as the given properties object.
|
CfgProperties(CfgPropItem[] itemsArr)
Creates a table of items using the given array of 'CfgPropItem'
objects.
|
CfgProperties(java.util.Vector vec)
Creates a table of items using the given Vector of 'CfgPropItem'
objects.
|
Modifier and Type | Method and Description |
---|---|
CfgPropItem |
add(java.lang.String nameStr,
java.lang.Object valueObj,
boolean requiredFlag,
java.lang.String cmdLnParamName,
java.lang.String descriptionStr)
Creates a new property item and adds it to the table.
|
CfgPropItem |
add(java.lang.String nameStr,
java.lang.Object valueObj,
boolean requiredFlag,
java.lang.String cmdLnParamName,
java.lang.String descriptionStr,
boolean cmdLnEnbFlag,
boolean helpScreenFlag,
boolean cmdLnOnlyFlag)
Creates a new property item and adds it to the table.
|
CfgPropItem |
add(java.lang.String nameStr,
java.lang.Object valueObj,
java.lang.String cmdLnParamName)
Creates a new property item and adds it to the table.
|
CfgPropItem |
add(java.lang.String nameStr,
java.lang.Object valueObj,
java.lang.String cmdLnParamName,
java.lang.String descriptionStr)
Creates a new property item and adds it to the table.
|
CfgPropItem |
add(java.lang.String nameStr,
java.lang.Object valueObj,
java.lang.String cmdLnParamName,
java.lang.String descriptionStr,
boolean cmdLnEnbFlag,
boolean helpScreenFlag)
Creates a new property item and adds it to the table.
|
CfgPropItem |
add(java.lang.String nameStr,
java.lang.Object valueObj,
java.lang.String cmdLnParamName,
java.lang.String descriptionStr,
boolean cmdLnEnbFlag,
boolean helpScreenFlag,
boolean cmdLnOnlyFlag)
Creates a new property item and adds it to the table.
|
void |
addGroupDataChangedListener(java.lang.Object groupSelObj,
DataChangedListener listenerObj)
Registers the given 'DataChangedListener' object with all items
that have the specified group selection object.
|
boolean |
areCompressedFlagsEnabled()
Determines if compressed flags are enabled.
|
protected CfgPropItem |
getCfgPropItem(java.lang.String nameStr,
boolean cmdLnParamFlag)
Get the configuration property item.
|
java.util.Vector |
getExtraCmdLnParamsVec()
Returns Vector of "extra" command-line parameters Strings filled
in by the 'processCmdLnParams()' method; or null if no "extra"
command-line parameters were found.
|
java.lang.String |
getHelpScreenData()
Returns a String of data for use on a command-line parameters
"help" screen.
|
java.lang.String |
getHelpScreenData(boolean displayPropertyName)
Returns a String of data for use on a command-line parameters
"help" screen.
|
java.lang.String |
getHelpScreenData(boolean displayPropertyName,
java.lang.String preText)
Returns a String of data for use on a command-line parameters
"help" screen.
|
java.lang.String |
getHelpScreenData(boolean displayPropertyName,
java.lang.String preText,
java.lang.String postText)
Returns a String of data for use on a command-line parameters
"help" screen.
|
java.lang.String |
getHelpScreenData(boolean displayPropertyName,
java.lang.String preText,
java.lang.String postText,
java.lang.String preDescText)
Returns a String of data for use on a command-line parameters
"help" screen.
|
static boolean |
isSwitchChar(char c)
Determines if the specified character is a switch character ('-' or '/').
|
boolean |
processCmdLnParams(java.lang.String[] args,
boolean allowExtrasFlag)
Processes the given command-line parameter strings using the table
of configuration property items.
|
boolean |
processCmdLnParams(java.lang.String[] args,
boolean allowExtrasFlag,
java.lang.String vInfoParam1,
java.lang.String vInfoParam2)
Processes the given command-line parameter strings using the table
of configuration property items.
|
boolean |
processCmdLnParams(java.lang.String[] args,
boolean allowExtrasFlag,
java.lang.String cfgFnParam1,
java.lang.String cfgFnParam2,
java.lang.String defCfgFnStr)
Processes the given command-line parameter strings using the table
of configuration property items.
|
boolean |
processCmdLnParams(java.lang.String[] args,
boolean allowExtrasFlag,
java.lang.String cfgFnParam1,
java.lang.String cfgFnParam2,
java.lang.String defCfgFnStr,
java.lang.String vInfoParam1,
java.lang.String vInfoParam2)
Processes the given command-line parameter strings using the table
of configuration property items.
|
protected boolean |
processExtraCmdLnParam(boolean allowExtrasFlag,
java.lang.String paramStr)
Process the extra command line parameter.
|
void |
removeGroupDataChangedListener(java.lang.Object groupSelObj,
DataChangedListener listenerObj)
Unregisters the given 'DataChangedListener' object with all items
that have the specified group selection object.
|
static java.lang.String |
removeSwitchChars(java.lang.String str)
Returns a copy of the given String with 1 to 2 leading switch
characters ('-' or '/') removed; or the original String if no
leading switch characters are found.
|
CfgProperties |
setCompressedFlagsEnabled(boolean b)
Determines if compressed flags should be enabled.
|
CfgProperties |
setDescriptionSeparatorString(java.lang.String s)
Set the description separator text.
|
CfgProperties |
setEmptyStringDefaultFlag(boolean flg)
Sets the default empty-string-default flag for the property items.
|
CfgProperties |
setStoreEmptyStringsFlag(boolean flg)
Set the store empty strings flag.
|
add, add, add, clear, containsKey, containsKey, containsValue, elements, entrySet, equals, get, get, getDisplayString, getDisplayString, getEmptyStringDefaultFlag, getErrorMessage, getLoadedCfgFname, hashCode, insertQuoteChars, isEmpty, isErrorAddAlreadyExist, isIgnoreUnknownPropertyNames, isStoreEmptyStringsFlag, keys, keySet, load, load, load, load, load, put, putAll, remove, remove, remove, setAllToDefaults, setErrorAddAlreadyExist, setErrorMessage, setIgnoreUnknownPropertyNames, setIllegalCharMsg, setLoadedFlags, setUnexpectedEOFMsg, size, store, store, store, store, values
public CfgProperties()
public CfgProperties(java.util.Vector vec)
vec
- vectorpublic CfgProperties(CfgPropItem[] itemsArr)
itemsArr
- items arraypublic CfgProperties(BaseProperties basePropObj)
basePropObj
- base property objectpublic CfgPropItem add(java.lang.String nameStr, java.lang.Object valueObj, boolean requiredFlag, java.lang.String cmdLnParamName, java.lang.String descriptionStr, boolean cmdLnEnbFlag, boolean helpScreenFlag, boolean cmdLnOnlyFlag)
nameStr
- the name for the property item.valueObj
- the default value object for the property item.requiredFlag
- the value for the item's required-flag (see
'CfgPropItem.setRequiredFlag()').cmdLnParamName
- command-line parameter name for item.descriptionStr
- description text for item.cmdLnEnbFlag
- true to enable use of item as command-line
parameter.helpScreenFlag
- true to include item in help screen data.cmdLnOnlyFlag
- true for item via command line only.public CfgPropItem add(java.lang.String nameStr, java.lang.Object valueObj, boolean requiredFlag, java.lang.String cmdLnParamName, java.lang.String descriptionStr)
nameStr
- the name for the property item.valueObj
- the default value object for the property item.requiredFlag
- the value for the item's required-flag (see
'CfgPropItem.setRequiredFlag()').cmdLnParamName
- command-line parameter name for item.descriptionStr
- description text for item.public CfgPropItem add(java.lang.String nameStr, java.lang.Object valueObj, java.lang.String cmdLnParamName, java.lang.String descriptionStr, boolean cmdLnEnbFlag, boolean helpScreenFlag)
nameStr
- the name for the property item.valueObj
- the default value object for the property item.cmdLnParamName
- command-line parameter name for item.descriptionStr
- description text for item.cmdLnEnbFlag
- true to enable use of item as command-line
parameter.helpScreenFlag
- true to include item in help screen data.public CfgPropItem add(java.lang.String nameStr, java.lang.Object valueObj, java.lang.String cmdLnParamName, java.lang.String descriptionStr, boolean cmdLnEnbFlag, boolean helpScreenFlag, boolean cmdLnOnlyFlag)
nameStr
- the name for the property item.valueObj
- the default value object for the property item.cmdLnParamName
- command-line parameter name for item.descriptionStr
- description text for item.cmdLnEnbFlag
- true to enable use of item as command-line
parameter.helpScreenFlag
- true to include item in help screen data.cmdLnOnlyFlag
- true for item via command line only.public CfgPropItem add(java.lang.String nameStr, java.lang.Object valueObj, java.lang.String cmdLnParamName, java.lang.String descriptionStr)
nameStr
- the name for the property item.valueObj
- the default value object for the property item.cmdLnParamName
- command-line parameter name for item.descriptionStr
- description text for item.public CfgPropItem add(java.lang.String nameStr, java.lang.Object valueObj, java.lang.String cmdLnParamName)
nameStr
- the name for the property item.valueObj
- the default value object for the property item.cmdLnParamName
- command-line parameter name for item.public boolean processCmdLnParams(java.lang.String[] args, boolean allowExtrasFlag, java.lang.String cfgFnParam1, java.lang.String cfgFnParam2, java.lang.String defCfgFnStr, java.lang.String vInfoParam1, java.lang.String vInfoParam2)
args
- the array of command-line parameter strings to process.allowExtrasFlag
- if false then all unmatched parameter names
are flagged as errors; if true then all unmatched parameter names
are stored in a Vector that can be retrieved via the
'getExtraCmdLnParamsVec()' method.cfgFnParam1
- a parameter name that may be used to specify a
configuration file name on the command line (or null for none).cfgFnParam2
- a second parameter name that may be used to specify
a configuration file name on the command line (or null for none).defCfgFnStr
- a default configuration file name, used if no
other configuration file name is specified on the command line (or
null for none). This configuration file is loaded before any other
command line parameters are processed. If the file cannot be found,
no error is flagged.vInfoParam1
- a parameter name that may be used to display program
version information (or null for none).vInfoParam2
- a second parameter name that may be used to display
program version information (or null for none).public boolean processCmdLnParams(java.lang.String[] args, boolean allowExtrasFlag, java.lang.String cfgFnParam1, java.lang.String cfgFnParam2, java.lang.String defCfgFnStr)
args
- the array of command-line parameter strings to process.allowExtrasFlag
- if false then all unmatched parameter names
are flagged as errors; if true then all unmatched parameter names
are stored in a Vector that can be retrieved via the
'getExtraCmdLnParamsVec()' method.cfgFnParam1
- a parameter name that may be used to specify a
configuration file name on the command line (or null for none).cfgFnParam2
- a second parameter name that may be used to specify
a configuration file name on the command line (or null for none).defCfgFnStr
- a default configuration file name, used if no
other configuration file name is specified on the command line (or
null for none). This configuration file is loaded before any other
command line parameters are processed. If the file cannot be found,
no error is flagged.public boolean processCmdLnParams(java.lang.String[] args, boolean allowExtrasFlag, java.lang.String vInfoParam1, java.lang.String vInfoParam2)
args
- the array of command-line parameter strings to process.allowExtrasFlag
- if false then all unmatched parameter names
are flagged as errors; if true then all unmatched parameter names
are stored in a Vector that can be retrieved via the
'getExtraCmdLnParamsVec()' method.vInfoParam1
- a parameter name that may be used to display program
version information (or null for none).vInfoParam2
- a second parameter name that may be used to display
program version information (or null for none).public boolean processCmdLnParams(java.lang.String[] args, boolean allowExtrasFlag)
args
- the array of command-line parameter strings to process.allowExtrasFlag
- if false then all unmatched parameter names
are flagged as errors; if true then all unmatched parameter names
are stored in a Vector that can be retrieved via the
'getExtraCmdLnParamsVec()' method.public static java.lang.String removeSwitchChars(java.lang.String str)
str
- stringpublic CfgProperties setCompressedFlagsEnabled(boolean b)
b
- true if compressed flags should be enabled, false otherwise.public CfgProperties setDescriptionSeparatorString(java.lang.String s)
s
- the the description separator text or null if none.public java.util.Vector getExtraCmdLnParamsVec()
public java.lang.String getHelpScreenData()
public java.lang.String getHelpScreenData(boolean displayPropertyName)
displayPropertyName
- true to always display the property name
(as well as the command-line parameter name), false to only display it
when there is no command-line parameter name.public java.lang.String getHelpScreenData(boolean displayPropertyName, java.lang.String preText)
displayPropertyName
- true to always display the property name
(as well as the command-line parameter name), false to only display it
when there is no command-line parameter name.preText
- text to be displayed before each command-line parameter
line or null for none.public java.lang.String getHelpScreenData(boolean displayPropertyName, java.lang.String preText, java.lang.String postText)
displayPropertyName
- true to always display the property name
(as well as the command-line parameter name), false to only display it
when there is no command-line parameter name.preText
- text to be displayed before each command-line parameter
line or null for none.postText
- text to be displayed after each command-line parameter
line or null for none.public java.lang.String getHelpScreenData(boolean displayPropertyName, java.lang.String preText, java.lang.String postText, java.lang.String preDescText)
displayPropertyName
- true to always display the property name
(as well as the command-line parameter name), false to only display it
when there is no command-line parameter name.preText
- text to be displayed before each command-line parameter
line or null for none.postText
- text to be displayed after each command-line parameter
line or null for none.preDescText
- the text to be displayed before the description.public static boolean isSwitchChar(char c)
str
- stringpublic void addGroupDataChangedListener(java.lang.Object groupSelObj, DataChangedListener listenerObj)
groupSelObj
- group selection object.listenerObj
- the 'DataChangedListener' object.public boolean areCompressedFlagsEnabled()
public void removeGroupDataChangedListener(java.lang.Object groupSelObj, DataChangedListener listenerObj)
groupSelObj
- group selection object.listenerObj
- the 'DataChangedListener' object.protected CfgPropItem getCfgPropItem(java.lang.String nameStr, boolean cmdLnParamFlag)
nameStr
- the name for the property item.cmdLnParamFlag
- true to only return a command line property item.protected boolean processExtraCmdLnParam(boolean allowExtrasFlag, java.lang.String paramStr)
allowExtrasFlag
- true if unmatched parameter names are allowed,
false otherwise.paramStr
- the parameter string.public CfgProperties setEmptyStringDefaultFlag(boolean flg)
BaseProperties
setEmptyStringDefaultFlag
in class BaseProperties
flg
- the flag value to use.public CfgProperties setStoreEmptyStringsFlag(boolean flg)
BaseProperties
setStoreEmptyStringsFlag
in class BaseProperties
flg
- the flag value to use.