Skip to content

jertocvil/envwrapper

Repository files navigation

envwrapper

Wrapper around environment variables for Java.

This library helps reducing boilerplate code for parsing and checking for existence of environment variables.

NOTE This is a proof of concept. Classes or annotation names will probably change.

Usage

Define an interface with the appropriate annotations. The only mandatory one is VarName because it defines the name of the environment variable to be read.

public interface TestConfig {
    @OptionalVar
    @VarName("LANG")
    String getLang();
}

Then get an automatically generated instance of the interface:

TestConfig config = EnvWrapper.getConfig(TestConfig.class);
String lang = config.getLang();
}

That's all

Details

A Proxy class implementing the configuration interface is generated. All methods are routed to a handler which does all the parsing and type checking.

About

Wrapper around environment variables for Java.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages