public class EnvironmentConfiguration extends MapConfiguration
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");
map
Constructor and Description |
---|
EnvironmentConfiguration()
Create a Configuration based on the environment variables.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addPropertyDirect(String key,
Object value)
Adds a property to this configuration.
|
protected void |
clearInternal()
Removes all properties from this configuration.
|
protected void |
clearPropertyDirect(String key)
Removes a property from this configuration.
|
clone, containsKeyInternal, getKeysInternal, getMap, getPropertyInternal, isEmptyInternal, isTrimmingDisabled, setTrimmingDisabled, sizeInternal, toString
addErrorLogListener, addProperty, addPropertyInternal, append, beginRead, beginWrite, clear, clearProperty, cloneInterpolator, containsKey, copy, endRead, endWrite, get, get, getArray, getArray, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCollection, getCollection, getConfigurationDecoder, getConversionHandler, getDouble, getDouble, getDouble, getEncodedString, getEncodedString, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getInterpolator, getKeys, getKeys, getKeysInternal, getList, getList, getList, getList, getListDelimiterHandler, getLogger, getLong, getLong, getLong, getProperties, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, getSynchronizer, immutableSubset, initLogger, installInterpolator, interpolate, interpolate, interpolatedConfiguration, isEmpty, isScalarValue, isThrowExceptionOnMissing, lock, setConfigurationDecoder, setConversionHandler, setDefaultLookups, setInterpolator, setListDelimiterHandler, setLogger, setParentInterpolator, setPrefixLookups, setProperty, setPropertyInternal, setSynchronizer, setThrowExceptionOnMissing, size, subset, unlock
addEventListener, clearErrorListeners, clearEventListeners, copyEventListeners, createErrorEvent, createEvent, fireError, fireEvent, getEventListenerRegistrations, getEventListeners, isDetailEvents, removeEventListener, setDetailEvents
public EnvironmentConfiguration()
System.getenv()
protected void addPropertyDirect(String key, Object value)
addPropertyDirect
in class MapConfiguration
key
- the key of the property to be addedvalue
- the property valueprotected void clearPropertyDirect(String key)
clearPropertyDirect
in class MapConfiguration
key
- the key of the property to be removedprotected void clearInternal()
clearInternal
in class AbstractConfiguration
Copyright © 2001–2020 The Apache Software Foundation. All rights reserved.