|
EAF 7.4 Util | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lutris.util.KeywordValueTable
public class KeywordValueTable
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.
Constructor Summary | |
---|---|
KeywordValueTable()
Constructor. |
Method Summary | |
---|---|
boolean |
containsKey(java.lang.String keyword)
Determine if the a field with the specified keyword exists. |
java.lang.Object |
get(java.lang.String keyword)
Get the value of a field as an object. |
java.lang.Object |
get(java.lang.String keyword,
java.lang.Object defaultValue)
Get the value of a field as an object, return a default if it does not exist. |
KeywordValueTable |
getSection(java.lang.String keyword)
Get the value of a section. |
java.lang.String |
getString(java.lang.String keyword)
Get the value of a field as a string |
java.lang.String |
getString(java.lang.String keyword,
java.lang.String defaultValue)
Get the value of a field as a string, return a default if it does not exist. |
java.lang.String[] |
keys()
Get the keywords in the table. |
java.lang.String[] |
leafKeys()
Recursively get the keywords for the entire table. |
protected KeywordValueTable |
newSection()
Allocate a new section. |
void |
remove(java.lang.String keyword)
Delete a field, if the field does not exist, the operation is ignored. |
void |
set(java.lang.String keyword,
java.lang.Object value)
Set the value of a field. |
void |
setDefault(java.lang.String keyword,
java.lang.Object defaultValue)
Sets a default value for a keyword. |
java.lang.String |
toHtml()
Convert to an Html representation. |
java.lang.String |
toString()
Convert to a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public KeywordValueTable()
Method Detail |
---|
protected KeywordValueTable newSection()
public java.lang.Object get(java.lang.String keyword) throws com.lutris.util.KeywordValueException
keyword
- The keyword of the field. This can be a simple keyword
or a recursive, dot-seperated keyword path.
KeywordValueException
- If the keyword is not syntactically
legal or is a non-leaf element of the keyword is not a section.public java.lang.Object get(java.lang.String keyword, java.lang.Object defaultValue) throws com.lutris.util.KeywordValueException
keyword
- The keyword of the field. This can be a simple keyword
or a recursive, dot-seperated keyword path.defaultValue
- The default value to return it the keyword does not
exist.
defaultValue
if its not found.
KeywordValueException
- If the keyword is not syntactically
legal or is a non-leaf element of the keyword is not a section.public java.lang.String getString(java.lang.String keyword) throws com.lutris.util.KeywordValueException
keyword
- The keyword of the field. This can be a simple keyword
or a recursive, dot-seperated keyword path.
KeywordValueException
- If the keyword is not syntactically
legal or is a non-leaf element of the keyword is not a section.public java.lang.String getString(java.lang.String keyword, java.lang.String defaultValue) throws com.lutris.util.KeywordValueException
keyword
- The keyword of the field. This can be a simple keyword
or a recursive, dot-seperated keyword path.
defaultValue
if its not found.
KeywordValueException
- If the keyword is not syntactically
legal or the value object is not a String.public KeywordValueTable getSection(java.lang.String keyword) throws com.lutris.util.KeywordValueException
keyword
- The keyword of the field. This can be a simple keyword
or a recursive, dot-seperated keyword path.
KeywordValueException
- If the keyword is not syntactically
legal or a non-leaf element of the
keyword is not a section or the value object is not a
KeywordValueTable.public void set(java.lang.String keyword, java.lang.Object value) throws com.lutris.util.KeywordValueException
keyword
- The keyword of the field. This can be a simple keyword
or a recursive, dot-seperated keyword path.value
- The value to associate with the keyword. The value may
not be null.
KeywordValueException
- If the keyword is not syntactically
legal.public void setDefault(java.lang.String keyword, java.lang.Object defaultValue) throws com.lutris.util.KeywordValueException
keyword
- The keyword of the field. This can be a simple keyword
or a recursive, dot-seperated keyword path.defaultValue
- The default value to associate with the keyword.
The default value may not be null. The default value is only
set if the specified keyword does
not already have a value associated with it.
KeywordValueException
- If the keyword is not syntactically
legal.public boolean containsKey(java.lang.String keyword) throws com.lutris.util.KeywordValueException
keyword
- The keyword of the field. This can be a simple keyword
or a recursive, dot-seperated keyword path.
true
if the code is in the table;
false
if its not.
KeywordValueException
- If the keyword is not syntactically
legal.public java.lang.String[] keys()
public java.lang.String[] leafKeys()
public void remove(java.lang.String keyword) throws com.lutris.util.KeywordValueException
keyword
- The keyword of the field. This can be a simple keyword
or a recursive, dot-seperated keyword path.
KeywordValueException
- If the keyword is not syntactically
legal.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toHtml()
|
EAF 7.4 Util | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |