|
Enhydra 3.1 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.lutris.util.KeywordValueTable | +--com.lutris.util.Config
Config is essentially a KeywordValueTable used for recursive
storage of data derived from a config file. The contents is
initialized but ConfigFile
.
ConfigFile
,
KeywordValueTable
, Serialized FormConstructor Summary | |
Config()
Default constructor for an empty Config. |
|
Config(ConfigFile configFile)
Constructor that associates this Config with a given ConfigFile. |
|
Config(KeywordValueTable kvt)
Constructor that takes a KeywordValueTable as initialization. |
|
Config(KeywordValueTable kvt,
ConfigFile configFile)
Constructor that takes a KeywordValueTable and a ConfigFile as initialization. |
Method Summary | |
int |
containsCount(java.lang.String key)
Returns the number of data elements for a given key, or -1 if the key is not found. |
boolean |
containsKey(java.lang.String key)
Returns true if the specified key is found,
false otherwise. |
boolean |
getBoolean(java.lang.String key)
Returns a single boolean value associated with a given key. |
boolean |
getBoolean(java.lang.String key,
boolean defaultValue)
Returns a single boolean value associated with a given key. |
boolean[] |
getBooleans(java.lang.String key)
Returns all boolean values associated with a given key. |
boolean[] |
getBooleans(java.lang.String key,
boolean[] defaultValue)
Returns all boolean values associated with a given key. |
Config |
getConfig(java.lang.String keyword)
Get the value of a section as a Config object. |
ConfigFile |
getConfigFile()
Get the ConfigFile associated with this object. |
double |
getDouble(java.lang.String key)
Returns a single double value associated with a given key. |
double |
getDouble(java.lang.String key,
double defaultValue)
Returns a single double value associated with a given key. |
double[] |
getDoubles(java.lang.String key)
Returns all double values associated with a given key. |
double[] |
getDoubles(java.lang.String key,
double[] defaultValue)
Returns all double values associated with a given key. |
int |
getInt(java.lang.String key)
Returns a single integer value associated with a given key. |
int |
getInt(java.lang.String key,
int defaultValue)
Returns a single integer value associated with a given key. |
int[] |
getInts(java.lang.String key)
Returns all integer values associated with a given key. |
int[] |
getInts(java.lang.String key,
int[] defaultValue)
Returns all integer values associated with a given key. |
long |
getLong(java.lang.String key)
Returns a single long integer value associated with a given key. |
long |
getLong(java.lang.String key,
long defaultValue)
Returns a single long integer value associated with a given key. |
long[] |
getLongs(java.lang.String key)
Returns all long integer values associated with a given key. |
long[] |
getLongs(java.lang.String key,
long[] defaultValue)
Returns all long integer values associated with a given key. |
KeywordValueTable |
getSection(java.lang.String keyword)
Get the value of a section as a KeywordValueTable object. |
java.lang.String |
getString(java.lang.String key)
Returns a single String value associated with a given key. |
java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue)
Returns a single String value associated with a given key. |
java.lang.String[] |
getStrings(java.lang.String key)
Returns all String values associated with a given key. |
java.lang.String[] |
getStrings(java.lang.String key,
java.lang.String[] defaultValue)
Returns all String values associated with a given key. |
boolean |
isArray(java.lang.String key)
Is the key is an array, or a single value. |
protected KeywordValueTable |
newSection()
Allocate a new section. |
Methods inherited from class com.lutris.util.KeywordValueTable |
get,
get,
keys,
leafKeys,
remove,
set,
setDefault,
toHtml,
toString |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public Config()
public Config(KeywordValueTable kvt)
kvt
- KeywordValueTable with which to initialize Configpublic Config(KeywordValueTable kvt, ConfigFile configFile)
kvt
- KeywordValueTable with which to initialize ConfigconfigFile
- ConfigFile to associate this Config object withpublic Config(ConfigFile configFile)
configFile
- ConfigFile to associate this object withMethod Detail |
protected KeywordValueTable newSection()
Config.
- Overrides:
- newSection in class KeywordValueTable
- Returns:
- A reference to a new section.
- See Also:
KeywordValueTable.newSection()
public ConfigFile getConfigFile()
ConfigFile
associated with this object.ConfigFile
,
null
if there is no config file associated with this
object.public Config getConfig(java.lang.String keyword) throws KeywordValueException
Config
object.keyword
- The keyword of the field. This can be a simple keyword
or a recursive, dot-seperated keyword path.KeywordValueTable.getSection(java.lang.String)
public KeywordValueTable getSection(java.lang.String keyword) throws KeywordValueException
KeywordValueTable
object.
This method overrides the KeywordValueTable.getSection in order to
insure that Config.getSection() always returns a Config object even
if a KeywordValueTable was inserted into the Config as a section.keyword
- The keyword of the field. This can be a simple keyword
or a recursive, dot-seperated keyword path.KeywordValueTable.getSection(java.lang.String)
public boolean containsKey(java.lang.String key)
true
if the specified key is found,
false
otherwise.key
- The key whose existence is to be tested.true
if the key was found,
otherwise false
.public int containsCount(java.lang.String key) throws ConfigException
-1
if the key is not found.key
- The key to search for.-1
if the key is not found.public boolean isArray(java.lang.String key) throws ConfigException
getStrings()
(or if you know the type
of the data, you can use, for example, getInts()
).
If this returns false, you shoud use getString()
(or if you know the type of the data, you can use, for example,
getInt()
).key
- The key to search for.public long getLong(java.lang.String key) throws ConfigException
ConfigException
exception is thrown.key
- The key to use to search for the configuration entry.ConfigException
public long getLong(java.lang.String key, long defaultValue) throws ConfigException
ConfigException
error is thrown with reason
set to COUNT
. If the retrieved element cannot be
converted to a long integer then a ConfigException
error
is thrown with reason
set to FORMAT
.key
- The key to use to search for the configuration entry.defaultValue
- The default value to use if the requested entry
does not exist.ConfigException
public long[] getLongs(java.lang.String key) throws ConfigException
ConfigException
error is thrown.key
- The key to use to search for the configuration entry.ConfigException
public long[] getLongs(java.lang.String key, long[] defaultValue) throws ConfigException
ConfigException
error is thrown.key
- The key to use to search for the configuration entry.defaultValue
- The default value to use if the requested entry
does not exist.ConfigException
public int getInt(java.lang.String key) throws ConfigException
ConfigException
exception is thrown.key
- The key to use to search for the configuration entry.ConfigException
public int getInt(java.lang.String key, int defaultValue) throws ConfigException
ConfigException
exception is thrown.key
- The key to use to search for the configuration entry.defaultValue
- The default value to use if the requested entry
does not exist.ConfigException
public int[] getInts(java.lang.String key) throws ConfigException
ConfigException
error is thrown.key
- The key to use to search for the configuration entry.ConfigException
public int[] getInts(java.lang.String key, int[] defaultValue) throws ConfigException
ConfigException
error is thrown.key
- The key to use to search for the configuration entry.defaultValue
- The default value to use if the requested entry
does not exist.ConfigException
public java.lang.String getString(java.lang.String key) throws ConfigException
ConfigException
exception is thrown.key
- The key to use to search for the configuration entry.ConfigException
public java.lang.String getString(java.lang.String key, java.lang.String defaultValue) throws ConfigException
ConfigException
exception is thrown.key
- The key to use to search for the configuration entry.defaultValue
- The default value to use if the requested entry
does not exist.ConfigException
public java.lang.String[] getStrings(java.lang.String key) throws ConfigException
ConfigException
error is thrown.key
- The key to use to search for the configuration entry.ConfigException
public java.lang.String[] getStrings(java.lang.String key, java.lang.String[] defaultValue) throws ConfigException
ConfigException
error is thrown.key
- The key to use to search for the configuration entry.defaultValue
- The default value to use if the requested entry
does not exist.ConfigException
public boolean getBoolean(java.lang.String key) throws ConfigException
ConfigException
exception is thrown.key
- The key to use to search for the configuration entry.ConfigException
public boolean getBoolean(java.lang.String key, boolean defaultValue) throws ConfigException
ConfigException
exception is thrown.key
- The key to use to search for the configuration entry.defaultValue
- The default value to use if the requested entry
does not exist.ConfigException
public boolean[] getBooleans(java.lang.String key) throws ConfigException
ConfigException
error is thrown.key
- The key to use to search for the configuration entry.ConfigException
public boolean[] getBooleans(java.lang.String key, boolean[] defaultValue) throws ConfigException
ConfigException
error is thrown.key
- The key to use to search for the configuration entry.defaultValue
- The default value to use if the requested entry
does not exist.ConfigException
public double getDouble(java.lang.String key) throws ConfigException
ConfigException
exception is thrown.key
- The key to use to search for the configuration entry.ConfigException
public double getDouble(java.lang.String key, double defaultValue) throws ConfigException
ConfigException
exception is thrown.key
- The key to use to search for the configuration entry.defaultValue
- The default value to use if the requested entry
does not exist.ConfigException
public double[] getDoubles(java.lang.String key) throws ConfigException
ConfigException
error is thrown.key
- The key to use to search for the configuration entry.ConfigException
public double[] getDoubles(java.lang.String key, double[] defaultValue) throws ConfigException
ConfigException
error is thrown.key
- The key to use to search for the configuration entry.defaultValue
- The default value to use if the requested entry
does not exist.ConfigException
|
Enhydra 3.1 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |