SurfConfiguration
Dependency
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())));