Apache Commons Configuration

SurfConfiguration
https://bitbucket.org/globalmentor/urf-apache-commons-configuration2-surf
Maven
io.urf:apache-commons-configuration2-surf
SurfConfiguration uses the SURF Reference Implementation.

SurfConfiguration Dependency

pom.xml
<project>
  …
  <dependencies>
    …
    <dependency>
      <groupId>io.urf</groupId>
      <artifactId>apache-commons-configuration2-surf</artifactId>
      <version>x.x.x</version>
    </dependency>
  </dependencies>
</project>

config.surf Configuration Builder

import java.nio.file.*;
import org.apache.commons.configuration2.*;  //etc.
…
import io.urf.apache.commons.configuration2.surf.*;
…
Path configFile = Paths.get("config.surf");
BuilderParameters configBuilderParams = new Parameters()
    .fileBased().setFile(configFile.toFile());
ConfigurationBuilder<SurfConfiguration> configurationBuilder =
    new FileBasedConfigurationBuilder<>(SurfConfiguration.class)
    .configure(configBuilderParams);

Access Configuration

Configuration config = configurationBuilder.getConfiguration();

LocalDate lastLogin = config.get(LocalDate.class, "lastLogin");
System.out.println(String.format("Last login %d days ago.",
    DAYS.between(lastLogin, LocalDate.now())));