|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jconfig.DefaultConfiguration
org.jconfig.NestedConfiguration
This class is the configuration itself. The Configuration is useful if one wants to manage multiple configurations. A single instance of the Configuration may contain, for example, information for one application or user.
Nested Class Summary |
Nested classes inherited from class org.jconfig.DefaultConfiguration |
DefaultConfiguration.MyCategoryListener |
Field Summary |
Fields inherited from class org.jconfig.DefaultConfiguration |
baseConfigName, categories, configName, mainCategory |
Constructor Summary | |
NestedConfiguration(java.lang.String configName)
The constructor that creates a new configuration with one empty category called "general". |
Method Summary | |
boolean |
containsCategory(java.lang.String categoryName)
Use this method to determine if a category exists. |
Category |
getCategory(java.lang.String name)
Returns a category based on the name provided. |
java.lang.String[] |
getCategoryNames()
This method returns a string array with all category names. |
protected java.lang.String[] |
getCategoryNames(boolean includeParent)
A convenience method that returns the key set in the form or a String Array. |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue,
java.lang.String categoryName)
This is the real implementation. |
java.lang.String |
getXMLAsString()
This method converts the Configuration into a String which looks like XML. |
void |
setCategory(Category category)
|
void |
setCategory(java.lang.String name,
boolean main)
Besides setting the category, it will also set this category as default category if main is true. |
java.lang.String |
toString()
This method creates a string representation of the configuration. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public NestedConfiguration(java.lang.String configName)
configName
- the name of the configurationMethod Detail |
public java.lang.String[] getCategoryNames()
Configuration
getCategoryNames
in interface Configuration
getCategoryNames
in class DefaultConfiguration
protected java.lang.String[] getCategoryNames(boolean includeParent)
DefaultConfiguration
getCategoryNames
in class DefaultConfiguration
includeParent
- true will check for a base configuration
and include those category names as well.
public void setCategory(java.lang.String name, boolean main)
setCategory
in interface Configuration
setCategory
in class DefaultConfiguration
name
- the name of the categorymain
- if true then this category is the default categorypublic void setCategory(Category category)
setCategory
in interface Configuration
setCategory
in class DefaultConfiguration
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue, java.lang.String categoryName)
getProperty
in interface Configuration
getProperty
in class DefaultConfiguration
key
- the name of the propertydefaultValue
- the default valuecategoryName
- the name of the category
public java.lang.String toString()
toString
in interface Configuration
toString
in class DefaultConfiguration
public java.lang.String getXMLAsString()
getXMLAsString
in interface Configuration
getXMLAsString
in class DefaultConfiguration
public Category getCategory(java.lang.String name)
getCategory
in interface Configuration
getCategory
in class DefaultConfiguration
name
- The name of the category (if null, main category will be used)
public boolean containsCategory(java.lang.String categoryName)
Configuration
containsCategory
in interface Configuration
containsCategory
in class DefaultConfiguration
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |