Skip to content

Prefix provider

Adrien LAUER edited this page Feb 23, 2017 · 1 revision

The prefix provider is implemented in org.seedstack.coffig.provider.PrefixProvider. It is a provider that takes two arguments:

  • A node prefix,
  • Another provider.

The resulting tree is the original tree provided by the provider specified as argument, but put under an "umbrella node". You can use the dot notation in the node prefix argument to specify a multi-level umbrella node.

Example

As an example, you can put all system properties under the sys node as follows:

Coffig.builder()
      .withProviders(new PrefixProvider("sys", new SystemPropertiesProvider()))
      .build();

The resulting provided tree will be:

sys:
  file.separator: "/"
  java.home: "..."
  java.vendor: "..."
  java.vendor.url: "..."

See also the system properties provider for details.

Clone this wiki locally