public final class XmlConfigurationSource extends AbstractConfigurationSource
ConfigurationSource for the source of type XMLConfiguration.
A property whose value is a sequence (ex: list, set) of objects must be placed in its own attribute name. For example
<?xml version="1.0" encoding="UTF-8" ?>
<config>
<name>Lays</name>
<type>Potato Chips</type>
<flavors>
<flavor>Barbecue</flavor>
<flavor>Onion Cream</flavor>
</flavors>
</config>
The sequence values are accessed by fully qualifying the name of the attributes.
config.getList("flavors.flavor");
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_PRIORITY |
| Modifier and Type | Method and Description |
|---|---|
static XmlConfigurationSource |
create(Reader reader)
Creates an instance of
XmlConfigurationSource. |
static XmlConfigurationSource |
create(Reader reader,
int priority)
Creates an instance of
XmlConfigurationSource. |
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, equals, hashCodepublic static final int DEFAULT_PRIORITY
public static XmlConfigurationSource create(Reader reader) throws org.apache.commons.configuration2.ex.ConfigurationException, IOException
XmlConfigurationSource.org.apache.commons.configuration2.ex.ConfigurationException - when fails to create the XMLConfigurationIOException - when fails to read from the readerNullPointerException - if the path to the xml file is nullpublic static XmlConfigurationSource create(Reader reader, int priority) throws org.apache.commons.configuration2.ex.ConfigurationException
XmlConfigurationSource.org.apache.commons.configuration2.ex.ConfigurationException - when fails to create the XMLConfigurationNullPointerException - if the path to the xml file is nullIllegalArgumentException - if the path to the xml file is not valid or the
priority is a negative valuepublic org.apache.commons.configuration2.Configuration getConfig()
ConfigurationSourceConfiguration object.public int getPriority()
ConfigurationSourceThe 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.