Skip to content
Adrien LAUER edited this page Feb 23, 2017 · 3 revisions

Coffig is a simple and powerful configuration library for the Java language. It is built upon the idea of mapping configuration trees to Java objects. The following configuration tree in YAML:

some:
  string: value1
  array: [1, 2, 3]
  object:
    attr1: value1
    attr2: [iris, jasmine, kiwi]

Can be retrieved as simply as:

Coffig coffig = Coffig.builder().withProviders(new JacksonProvider().addSource("url/to/file.yaml")).build();
    
String stringValue = coffig.get(String.class, "some.string");
int[] intArray = coffig.get(int[].class, "some.array");
MyPojo myPojo = coffig.get(MyPojo.class, "some.object");
String defaultValue = coffig.getOptional(String.class, "unknown.node").orElse("default");
Clone this wiki locally