public interface ConfigurationSource extends Comparable<ConfigurationSource>
Configuration
.
It is strictly recommended that no Concrete class should implement this interface directly.
Instead they should be extend from AbstractConfigurationSource
to ensure that all the
ConfigurationSources are compared using the same method
AbstractConfigurationSource.compareTo(ConfigurationSource)
.
Every implementation of ConfigurationSource
must have a priority (an Integer
value) set on them. Configurations are loaded based on the priority set on them. The properties
from the lower priority configurations are overriden by the higher priority configurations.
Note: The implementations of this interface have a natural ordering that is
inconsistent with the Object.equals(java.lang.Object)
method. Two Configuration classes might have an equal
priority but might not be equal. Hence the natural ordering on the implementations of this
interface MUST NOT be used to determine the equality of the objects. The Natural ordering of the
instances can be obtained from the getPriority()
method.
Comparable
,
AbstractConfigurationSource
Modifier and Type | Method and Description |
---|---|
org.apache.commons.configuration2.Configuration |
getConfig()
Returns the Configuration from the ConfigurationSource.
|
int |
getPriority()
Returns the priority of the current ConfigurationSources among other ConfigurationSources.
|
compareTo
org.apache.commons.configuration2.Configuration getConfig()
Configuration
object.int getPriority()
The return value signifies the natural ordering of the instances. Greater Value implies higher priority. Higher Priority ConfigurationSources overrides any matching properties from the lower priority ConfigurationSources.
The priority on a ConfigurationSource
must not be negative.
Copyright © 2020 Cerner Innovation, Inc.. All rights reserved.