|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.configuration.event.EventSource
org.apache.commons.configuration.AbstractConfiguration
org.apache.commons.configuration.MapConfiguration
org.apache.commons.configuration.EnvironmentConfiguration
public class EnvironmentConfiguration
A Configuration implementation that reads the platform specific
environment variables using the map returned by System.getenv()
.
This configuration implementation is read-only. It allows read access to the
defined OS environment variables, but their values cannot be changed. Any
attempts to add or remove a property will throw an
UnsupportedOperationException
Usage of this class is easy: After an instance has been created the get
methods provided by the Configuration
interface can be used
for querying environment variables, e.g.:
Configuration envConfig = new EnvironmentConfiguration(); System.out.println("JAVA_HOME=" + envConfig.getString("JAVA_HOME");
Field Summary |
---|
Fields inherited from class org.apache.commons.configuration.MapConfiguration |
---|
map |
Fields inherited from class org.apache.commons.configuration.AbstractConfiguration |
---|
END_TOKEN, EVENT_ADD_PROPERTY, EVENT_CLEAR, EVENT_CLEAR_PROPERTY, EVENT_READ_PROPERTY, EVENT_SET_PROPERTY, START_TOKEN |
Constructor Summary | |
---|---|
EnvironmentConfiguration()
Create a Configuration based on the environment variables. |
Method Summary | |
---|---|
protected void |
addPropertyDirect(java.lang.String key,
java.lang.Object value)
Adds a property to this configuration. |
void |
clear()
Removes all properties from this configuration. |
void |
clearProperty(java.lang.String key)
Removes a property from this configuration. |
Methods inherited from class org.apache.commons.configuration.MapConfiguration |
---|
clearPropertyDirect, clone, containsKey, getKeys, getMap, getProperty, isEmpty, isTrimmingDisabled, setTrimmingDisabled |
Methods inherited from class org.apache.commons.configuration.event.EventSource |
---|
addConfigurationListener, addErrorListener, clearConfigurationListeners, clearErrorListeners, createErrorEvent, createEvent, fireError, fireEvent, getConfigurationListeners, getErrorListeners, isDetailEvents, removeConfigurationListener, removeErrorListener, setDetailEvents |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EnvironmentConfiguration()
System.getenv()
Method Detail |
---|
protected void addPropertyDirect(java.lang.String key, java.lang.Object value)
addPropertyDirect
in class MapConfiguration
key
- the key of the property to be addedvalue
- the property valuepublic void clearProperty(java.lang.String key)
clearProperty
in interface Configuration
clearProperty
in class AbstractConfiguration
key
- the key of the property to be removedpublic void clear()
clear
in interface Configuration
clear
in class AbstractConfiguration
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |