public final class HoconPropertiesConfigSource extends Object implements PropertiesConfigSource
PropertiesConfigSource
that reads HOCON configs
into properties for incorporation into MultiPropertiesConfig
.
HOCON config files are read as resources by an identifier, which might look like
hocon:reference,application,special.json,scoped.conf#my-scope,/
All Configs found are merged, with later elements in the list taking preference over
earlier elements. Substitutions within the full, merged Config are resolved.
Elements that have no suffix (or, more exactly, that contain no '.' character) are read
appending all three HOCON standard suffixes, so that "xxx" reads all three of
xxx.conf, xxx.json, and xxx.properties.
Anything that follows a '#' character in an identifier is treated as a scope,
such that the only Config loaded (as the new top-level!) are those underneath
the scope key. So, in JSON format, if the config under scoped.conf is
{
"some-top-level-key" : "hello",
"my-scope" : {
"a" : "apple",
"b" : "book",
"c" : "cat"
}
}
scoped.conf#my-scope will be read as:
{
"a" : "apple",
"b" : "book",
"c" : "cat"
}
The special element '/' refers to a Config containing System properties.
Following HOCON config conventions, resources under the identifier 'application'
will be replaced if any of "config.resource", "config.file", or "config.url"
are set.PropertiesConfigSource.Parse
Constructor and Description |
---|
HoconPropertiesConfigSource() |
Modifier and Type | Method and Description |
---|---|
PropertiesConfigSource.Parse |
propertiesFromSource(ClassLoader cl,
String identifier) |
PropertiesConfigSource.Parse |
propertiesFromSource(String identifier)
An Exception signifies this source cannot be parsed at all;
it is a bad source.
|
public PropertiesConfigSource.Parse propertiesFromSource(ClassLoader cl, String identifier) throws FileNotFoundException, Exception
FileNotFoundException
Exception
public PropertiesConfigSource.Parse propertiesFromSource(String identifier) throws FileNotFoundException, Exception
PropertiesConfigSource
propertiesFromSource
in interface PropertiesConfigSource
FileNotFoundException
Exception
Copyright © 2018 com.mchange. All rights reserved.