| java.lang.Object com.lutris.util.KeywordValueTable
All known Subclasses: com.lutris.util.Config, com.lutris.appserver.server.session.SessionData, com.lutris.appserver.server.ApplicationData,
KeywordValueTable | public class KeywordValueTable implements java.io.Serializable(Code) | | Class that implements a recursive keyword/value table. The key is a string
that is restricted to be a valid Java identifier. That is, starting with
an letter and containing letters or digits. The characters '_' and '$'
are also allowed and are treated as letters. The value maybe any object.
A keyword and its value are collectively referred to as a field
The table is recursive. Values of class KeywordValueTable are referred to as
sections. A field of a section maybe addressed from the parent
object using a dot ('.') separated name path.
version: $Revision: 1.3 $ author: Mark Diekhans since: Harmony 1.0 |
Method Summary | |
public synchronized boolean | containsKey(String keyword) Determine if the a field with the specified keyword exists.
Parameters: keyword - The keyword of the field. | public synchronized Object | get(String keyword) Get the value of a field as an object.
Parameters: keyword - The keyword of the field. | public synchronized Object | get(String keyword, Object defaultValue) Get the value of a field as an object, return a default if it
does not exist.
Parameters: keyword - The keyword of the field. | public synchronized KeywordValueTable | getSection(String keyword) Get the value of a section. | public synchronized String | getString(String keyword) Get the value of a field as a string
Parameters: keyword - The keyword of the field. | public synchronized String | getString(String keyword, String defaultValue) Get the value of a field as a string, return a default if it
does not exist.
Parameters: keyword - The keyword of the field. | public synchronized String[] | keys() Get the keywords in the table. | public synchronized String[] | leafKeys() Recursively get the keywords for the entire table. | protected KeywordValueTable | newSection() Allocate a new section. | public synchronized void | remove(String keyword) Delete a field, if the field does not exist, the operation is ignored.
Parameters: keyword - The keyword of the field. | public synchronized void | set(String keyword, Object value) Set the value of a field. | public synchronized void | setDefault(String keyword, Object defaultValue) Sets a default value for a keyword. | public synchronized String | toHtml() Convert to an Html representation. | public synchronized String | toString() Convert to a string. |
KeywordValueTable | public KeywordValueTable()(Code) | | Constructor.
|
containsKey | public synchronized boolean containsKey(String keyword) throws KeywordValueException(Code) | | Determine if the a field with the specified keyword exists.
Parameters: keyword - The keyword of the field. This can be a simple keywordor a recursive, dot-seperated keyword path. true if the code is in the table;false if its not. exception: KeywordValueException - If the keyword is not syntacticallylegal. |
get | public synchronized Object get(String keyword) throws KeywordValueException(Code) | | Get the value of a field as an object.
Parameters: keyword - The keyword of the field. This can be a simple keywordor a recursive, dot-seperated keyword path. The object value or null if its not found. exception: KeywordValueException - If the keyword is not syntactically legal or is a non-leaf element of the keyword is not a section. |
get | public synchronized Object get(String keyword, Object defaultValue) throws KeywordValueException(Code) | | Get the value of a field as an object, return a default if it
does not exist.
Parameters: keyword - The keyword of the field. This can be a simple keywordor a recursive, dot-seperated keyword path. Parameters: defaultValue - The default value to return it the keyword does notexist. The object value or defaultValue if its not found. exception: KeywordValueException - If the keyword is not syntactically legal or is a non-leaf element of the keyword is not a section. |
getSection | public synchronized KeywordValueTable getSection(String keyword) throws KeywordValueException(Code) | | Get the value of a section. The section is a value that is another
KeywordValueTable object.
Parameters: keyword - The keyword of the field. This can be a simple keywordor a recursive, dot-seperated keyword path. A reference to the section object or null if not found. exception: KeywordValueException - If the keyword is not syntacticallylegal or a non-leaf element of thekeyword is not a section or the value object is not aKeywordValueTable. |
getString | public synchronized String getString(String keyword) throws KeywordValueException(Code) | | Get the value of a field as a string
Parameters: keyword - The keyword of the field. This can be a simple keyword or a recursive, dot-seperated keyword path. The result of calling toString on the value objector null if its not found. exception: KeywordValueException - If the keyword is not syntactically legal or is a non-leaf element of the keyword is not a section. |
getString | public synchronized String getString(String keyword, String defaultValue) throws KeywordValueException(Code) | | Get the value of a field as a string, return a default if it
does not exist.
Parameters: keyword - The keyword of the field. This can be a simple keyword or a recursive, dot-seperated keyword path. The result of calling toString on the value objector defaultValue if its not found. exception: KeywordValueException - If the keyword is not syntacticallylegal or the value object is not a String. |
keys | public synchronized String[] keys()(Code) | | Get the keywords in the table. This is only the keywords at the top
level, its doesn't recurse.
An string array of the keywords. |
leafKeys | public synchronized String[] leafKeys()(Code) | | Recursively get the keywords for the entire table. This returns the
full keyword of all leaf values.
An string array of the keywords. |
newSection | protected KeywordValueTable newSection()(Code) | | Allocate a new section. The default implementation of this
method returns a new KeywordValueTable object. A class derived
from KeywordValueTable overrides this method to create a new
object of the derived type. Sections are only allocated by
this method.
A reference to a new section. |
remove | public synchronized void remove(String keyword) throws KeywordValueException(Code) | | Delete a field, if the field does not exist, the operation is ignored.
Parameters: keyword - The keyword of the field. This can be a simple keywordor a recursive, dot-seperated keyword path. exception: KeywordValueException - If the keyword is not syntacticallylegal. |
set | public synchronized void set(String keyword, Object value) throws KeywordValueException(Code) | | Set the value of a field. If a keyword path is specified and the
subsections do not exist, they are created. If a field other than
a KeywordValueTable is one of the intermediate sections in the path, it
will be deleted and replaced by a section.
Parameters: keyword - The keyword of the field. This can be a simple keywordor a recursive, dot-seperated keyword path. Parameters: value - The value to associate with the keyword. The value maynot be null. exception: KeywordValueException - If the keyword is not syntacticallylegal. |
setDefault | public synchronized void setDefault(String keyword, Object defaultValue) throws KeywordValueException(Code) | | Sets a default value for a keyword. This method only sets a value
for the specified keyword if a value is not already set for
that keyword. If a value is not set for the keyword, then
if a keyword path is specified and the
subsections do not exist, they are created. If a field other than
a KeywordValueTable is one of the intermediate sections in the path, it
will be deleted and replaced by a section.
Parameters: keyword - The keyword of the field. This can be a simple keywordor a recursive, dot-seperated keyword path. Parameters: defaultValue - The default value to associate with the keyword.The default value may not be null. The default value is onlyset if the specified keyword doesnot already have a value associated with it. exception: KeywordValueException - If the keyword is not syntacticallylegal. |
toHtml | public synchronized String toHtml()(Code) | | Convert to an Html representation.
the generated Html. |
toString | public synchronized String toString()(Code) | | Convert to a string.
Generate a string representation of this object. |
|
|