Top Description Constructors Methods
com.mchange.v3.hocon

public final Class HoconPropertiesConfigSource

extends Object
implements PropertiesConfigSource
Class Inheritance
All Implemented Interfaces
com.mchange.v2.cfg.PropertiesConfigSource
Imports
java.util.*, java.io.*, com.typesafe.config.*, com.mchange.v2.cfg.*, com.mchange.v2.lang.SystemUtils, java.net.MalformedURLException, .URL

An implementation of com.mchange.v2.cfg.PropertiesConfigSource that reads HOCON configs into properties for incorporation into com.mchange.v2.cfg.MultiPropertiesConfig. HOCON config files are read as resources by an identifier, which might look like hocon:reference,application,special.json,scoped.conf#my-scope,/ Elements within this path are interpreted as URLs if they contain a colon, e.g. hocon:reference,application,http://my.host.name/networkconfig,/ URL elements can contain substitutions based on System properties or environment variables (with System properties taking preference if both are found) hocon:reference,application,file:${user.home}/.myconfig,/ NOTE: Hash symbols (#) within URLs will be interpreted as denoting a config scope (see below). They and any subsequent text will NOT be treated as part of the URL 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.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static Config
public PropertiesConfigSource.Parse
public PropertiesConfigSource.Parse
propertiesFromSource(String identifier)

Implements com.mchange.v2.cfg.PropertiesConfigSource.propertiesFromSource.

An Exception signifies this source cannot be parsed at all; it is a bad source.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

HoconPropertiesConfigSourceback to summary
public HoconPropertiesConfigSource()

Method Detail

extractConfigback to summary
private static Config extractConfig(ClassLoader cl, String identifier, List<DelayedLogItem> dlis) throws FileNotFoundException, Exception
propertiesFromSourceback to summary
public PropertiesConfigSource.Parse propertiesFromSource(ClassLoader cl, String identifier) throws FileNotFoundException, Exception
propertiesFromSourceback to summary
public PropertiesConfigSource.Parse propertiesFromSource(String identifier) throws FileNotFoundException, Exception

Implements com.mchange.v2.cfg.PropertiesConfigSource.propertiesFromSource.

Doc from com.mchange.v2.cfg.PropertiesConfigSource.propertiesFromSource.

An Exception signifies this source cannot be parsed at all; it is a bad source. More local failures should be handled and reported in parse messages.