|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--bill.util.config.ConfigurationSection
This class contains the information associated with a section of a configuration file. It also contains methods for searching the list of entries associated with the section.
Constructor Summary | |
ConfigurationSection(String sectionName)
Class creator. |
|
ConfigurationSection(String sectionName,
short entryConflictMode)
Class creator. |
Method Summary | |
void |
addEntry(ConfigurationEntry newEntry)
Inserts a new entry into the hashtable of this section's entries. |
void |
addEntry(ConfigurationEntry newEntry,
int index)
Inserts a new entry into the hashtable of this section's entries at the specified index. |
void |
addEntry(String entryName,
String entryValue)
Inserts a new entry into the hashtable of this section's entries. |
void |
addEntry(String entryName,
String entryValue,
int index)
Inserts a new entry into the hashtable of this section's entries at the specified index. |
Hashtable |
getEntries()
Getter for this hashtable of entries for this section. |
ConfigurationEntry |
getEntry(String entryName)
Retrieves the ConfigurationEntry class instance of the specified entry from this section. |
ConfigurationEntry |
getEntry(String entryName,
int entryInstance)
Retrieves the ConfigurationEntry class instance of the specified entry from this section. |
short |
getEntryConflictMode()
Retrieves the entry conflict mode this section uses to resolve duplicate entry adds. |
Vector |
getEntryNames()
Used to retrieve a Vector of the entries contained in this section. |
int |
getEntryQuantity(String entryName)
Determines how many entries of the specified name exist for this section. |
String |
getEntryValue(String entryName)
Retrieves the value of the specified entry from this section. |
String |
getEntryValue(String entryName,
int entryInstance)
Retrieves the value of the specified entry from this section. |
int |
getEntryValueAsInteger(String entryName)
Retrieves the value of the specified entry from this section as an Integer. |
int |
getEntryValueAsInteger(String entryName,
int entryInstance)
Retrieves the value of the specified entry from this section. |
int |
getNumberOfEntries()
Determines the number of entries contained in this section. |
String |
getSectionName()
Retrieves the name of this section. |
int |
indexOf(String entryName)
Determines the index of the first entry with the specified name. |
int |
indexOf(String entryName,
int index)
Determines the index of the first entry with the specified name beginning the search at the specified index. |
boolean |
isEntry(String entryName)
Checks to see if this entry exists in the section. |
boolean |
isEntry(String entryName,
int entryInstance)
Checks to see if this entry exists in the section. |
void |
merge(ConfigurationSection section)
Merges the entries from the specified section into the current section. |
boolean |
removeEntry(ConfigurationEntry entry)
Removes an entry from this section. |
boolean |
removeEntry(String entryName)
Removes the ConfigurationEntry class instance of the specified entry from this section. |
void |
setEntries(Hashtable entries)
Setter for the hashtable of entries for this section. |
void |
setEntryConflictMode(short entryConflictMode)
Sets the entry conflict mode this section uses to resolve duplicate entry adds. |
void |
setEntryNames(Vector entryNames)
Setter for the ordered list of this section's entry names. |
void |
setEntryValue(String entryName,
String entryValue)
Adds a new entry to this section. |
void |
setSectionName(String sectionName)
Sets the name of this section. |
void |
swapEntries(ConfigurationEntry firstEntry,
ConfigurationEntry secondEntry)
Swap the position of two entries in the ordered list of entries. |
void |
swapEntries(int first,
int second)
Swap the position of two entries in the ordered list of entries. |
void |
swapEntries(String firstName,
String secondName)
Swap the position of two entries in the ordered list of entries. |
String |
toFullString()
Returns a string representation of the ConfigurationSection class, including all it's ConfigurationEntities. |
String |
toString()
Returns a string representation of the ConfigurationSection class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ConfigurationSection(String sectionName)
sectionName
- Name of the section being createdpublic ConfigurationSection(String sectionName, short entryConflictMode)
sectionName
- Name of the section being createdentryConflictMode
- Specifies the entry conflict resolution mode to
use when duplicate entries are added to a section.Method Detail |
public String getSectionName()
public short getEntryConflictMode()
public String getEntryValue(String entryName)
entryName
- Name of the entry whose value is to be retrievednull
if the entry could not
be found.public int getEntryValueAsInteger(String entryName)
entryName
- Name of the entry whose value is to be retrieved0
if the entry could not
be found.public String getEntryValue(String entryName, int entryInstance)
entryName
- Name of the entry whose value is to be retrievedentryInstance
- Which instance of the entry to retrieve. This is
a 0 based value, so the first instance is instance 0, the second is 1,
etc.null
if the entry could not
be found.public int getEntryValueAsInteger(String entryName, int entryInstance)
entryName
- Name of the entry whose value is to be retrievedentryInstance
- Which instance of the entry to retrieve. This is
a 0 based value, so the first instance is instance 0, the second is 1,
etc.0
if the entry could not
be found.public int getEntryQuantity(String entryName)
entryName
- The name of the entry to get the quantity of.public ConfigurationEntry getEntry(String entryName)
entryName
- Name of the entry to be retrievednull
if the entry
could not be found.public ConfigurationEntry getEntry(String entryName, int entryInstance)
entryName
- Name of the entry to be retrievedentryInstance
- Which instance of the entry to retrieve. This is
a 0 based value, so the first instance is instance 0, the second is 1,
etc.null
if the entry
could not be found.public boolean removeEntry(String entryName)
entryName
- Name of the entry to be removedTrue
if the entry is removed, false
if
the entry is not.public boolean removeEntry(ConfigurationEntry entry)
entry
- The entry to remove.true
on success, false
otherwise.public void addEntry(ConfigurationEntry newEntry) throws ConfigurationException
newEntry
- The entry to be insertedConfigurationException
- Thrown when there is already an existing
entry by this name and entry conflict resolution has been set to
Configuration.ENTRY_CONFLICT_DISCARD.
public void addEntry(ConfigurationEntry newEntry, int index) throws ConfigurationException
newEntry
- The entry to be insertedindex
- The index to insert the entry at.ConfigurationException
- Thrown when there is already an existing
entry by this name and entry conflict resolution has been set to
Configuration.ENTRY_CONFLICT_DISCARD.
public void addEntry(String entryName, String entryValue) throws ConfigurationException
entryName
- The name of the entry to be insertedentryValue
- The value of the entry to be insertedConfigurationException
- Thrown when there is already an existing
entry by this name and entry conflict resolution has been set to
Configuration.ENTRY_CONFLICT_DISCARD.
public void addEntry(String entryName, String entryValue, int index) throws ConfigurationException
entryName
- The name of the entry to be inserted.entryValue
- The value of the entry to be inserted.index
- The index to insert the entry at.ConfigurationException
- Thrown when there is already an existing
entry by this name and entry conflict resolution has been set to
Configuration.ENTRY_CONFLICT_DISCARD.
public void merge(ConfigurationSection section) throws ConfigurationException
section
- The section to be merged in.ConfigurationException
- Thrown when one or more entries from the
specified section cannot be added to the current section. This is
typically caused by duplicate entries when the target section has an
Entry Conflict Mode of Configuration.ENTRY_CONFLICT_DISCARD
.public Hashtable getEntries()
public Vector getEntryNames()
public void setSectionName(String sectionName)
sectionName
- Value to set the section name to.public void setEntryConflictMode(short entryConflictMode)
entryConflictMode
- The entry conflict mode.public void setEntries(Hashtable entries)
entries
- Hashtable of entries and their values to set this
section to.Configuration.save()
,
setEntryNames(java.util.Vector)
public void setEntryNames(Vector entryNames)
entryNames
- Vector containing the ordered list of entry names.public void setEntryValue(String entryName, String entryValue) throws ConfigurationException
entryName
- Name of the new entry to add or set.entryValue
- Value to give the entry.ConfigurationException
- Thrown when there is already an existing
entry by this name and entry conflict resolution has been set to
Configuration.ENTRY_CONFLICT_DISCARD.
public void swapEntries(int first, int second)
first
- Index of the first entry we are switchingsecond
- Index of the second entry we are switchingpublic void swapEntries(String firstName, String secondName)
firstName
- Entry name of the first entry we are switchingsecondName
- Entry name of the second entry we are switchingpublic void swapEntries(ConfigurationEntry firstEntry, ConfigurationEntry secondEntry)
firstEntry
- First entry we are switchingsecondEntry
- Second entry we are switchingpublic int indexOf(String entryName)
entryName
- The name of the entry to look for.public int indexOf(String entryName, int index)
entryName
- The name of the entry to look for.index
- The index to start the search at.public int getNumberOfEntries()
public boolean isEntry(String entryName)
entryName
- The name of the entry to look for.true
if the entry exists, false
otherwise.public boolean isEntry(String entryName, int entryInstance)
entryName
- The name of the entry to look for.entryInstance
- Which instance of the entry to retrieve. This is
a 0 based value, so the first instance is instance 0, the second is 1,
etc.true
if the entry exists, false
otherwise.public String toString()
toString
in class Object
public String toFullString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |