SystemConfiguration (Apache Commons Configuration 2.15.1 API)
Description: declaration: package: org.apache.commons.configuration2, class: SystemConfiguration

Package org.apache.commons.configuration2

# Class SystemConfiguration

java.lang.Object
org.apache.commons.configuration2.event.BaseEventSource
org.apache.commons.configuration2.AbstractConfiguration
org.apache.commons.configuration2.MapConfiguration
org.apache.commons.configuration2.SystemConfiguration

All Implemented Interfaces:
  `Cloneable`, `Configuration`, `EventSource`, `ImmutableConfiguration`, `SynchronizerSupport`

public class SystemConfiguration extends MapConfiguration
A configuration based on the system properties.

Since:
  1.1

- ## Field Summary

  ### Fields inherited from class org.apache.commons.configuration2.MapConfiguration

  `map`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SystemConfiguration()`
  Create a Configuration based on the system properties.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Iterator<String>`
  `getKeysInternal()`
  Creates an iterator for iterating over the keys in this configuration.
  `static void`
  `setSystemProperties(String fileName)`
  Sets system properties from a file specified by its file name.
  `static void`
  `setSystemProperties(String basePath, String fileName)`
  Sets system properties from a file specified using its base path and file name.
  `static void`
  `setSystemProperties(Configuration systemConfig)`
  Sets System properties from a configuration object.

  ### Methods inherited from class org.apache.commons.configuration2.MapConfiguration

  `addPropertyDirect, clearPropertyDirect, clone, containsKeyInternal, containsValueInternal, getMap, getPropertyInternal, isEmptyInternal, isTrimmingDisabled, setTrimmingDisabled, sizeInternal, toString`

  ### Methods inherited from class org.apache.commons.configuration2.AbstractConfiguration

  `addErrorLogListener, addProperty, addPropertyInternal, append, beginRead, beginWrite, clear, clearInternal, clearProperty, cloneInterpolator, contains, containsKey, containsValue, copy, endRead, endWrite, get, get, getArray, getArray, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCollection, getCollection, getConfigurationDecoder, getConversionHandler, getDouble, getDouble, getDouble, getDuration, getDuration, getEncodedString, getEncodedString, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getInterpolator, getKeys, getKeys, getKeys, getKeysInternal, 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`

  ### Methods inherited from class org.apache.commons.configuration2.event.BaseEventSource

  `addEventListener, clearErrorListeners, clearEventListeners, copyEventListeners, createErrorEvent, createEvent, fireError, fireEvent, getEventListenerRegistrations, getEventListeners, isDetailEvents, removeEventListener, setDetailEvents`

  ### Methods inherited from class java.lang.Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface org.apache.commons.configuration2.ImmutableConfiguration

  `entrySet, forEach, getEnum, getEnum`

- ## Constructor Details

  - ### SystemConfiguration

    public SystemConfiguration()
    Create a Configuration based on the system properties.
    See Also:
      - `System.getProperties()`

- ## Method Details

  - ### setSystemProperties

    public static void setSystemProperties(Configuration systemConfig)
    Sets System properties from a configuration object.
    Parameters:
      `systemConfig` - The configuration containing the properties to be set.
    Since:
      1.6

  - ### setSystemProperties

    public static void setSystemProperties(String fileName) throws ConfigurationException
    Sets system properties from a file specified by its file name. This is just a short cut for `setSystemProperties(null, fileName)`.
    Parameters:
      `fileName` - The name of the property file.
    Throws:
      `ConfigurationException` - if an error occurs.
    Since:
      1.6

  - ### setSystemProperties

    public static void setSystemProperties(String basePath, String fileName) throws ConfigurationException
    Sets system properties from a file specified using its base path and file name. The file can either be a properties file or an XML properties file. It is loaded, and all properties it contains are added to system properties.
    Parameters:
      `basePath` - The base path to look for the property file.
      `fileName` - The name of the property file.
    Throws:
      `ConfigurationException` - if an error occurs.
    Since:
      1.6

  - ### getKeysInternal

    protected Iterator<String> getKeysInternal()
    Creates an iterator for iterating over the keys in this configuration. This method is called by `getKeys()`, it has to be defined by concrete subclasses. This implementation returns a snapshot of the keys in the system properties. If another thread modifies system properties concurrently, these changes are not reflected by the iterator returned by this method.
    Overrides:
      `getKeysInternal` in class `MapConfiguration`
    Returns:
      an `Iterator` with all property keys in this configuration.