-
-
Notifications
You must be signed in to change notification settings - Fork 229
Description
Project description
For dealing with properties/configuration files in java, and mapping them to interfaces there is an already incredible OWNER framework. As you can see on the basic usage page, it allows us to very conveniently abstract where and how something is configured.
It would be nice to have something very similar but with the following differences:
- Instead of creating 'proxy' objects for the actual implementations at runtime, they should be generated during compile time. I want the usage to be like dagger (I have never used dagger myself though)
- Support lazy loading/delegate the loading to a user provided class. relevant issue on the owner repo
- Nested Configurations, almost ready in owner! relevant PR (almost there!)
Basic Usage (copied from the basic usage link above)
ServerConfig.properties
port=80 hostname=foobar.com maxThreads=100
ServerConfig.java
public interface ServerConfig extends Config {
int port();
String hostname();
@DefaultValue("42")
int maxThreads();
}
elsewhere in the code...
ServerConfig cfg = ???ServerConfigFactory.get(); System.out.println(cfg.hostname() + ":" + cfg.port() + " will run " + cfg.maxThreads());
Relevant Technology
I think it should be compatible with java 8's default interfaces, and follow in OWNER's philosophy of having 0 dependencies.
very basic annotations processing article: https://deors.wordpress.com/2011/10/08/annotation-processors/
Who is this for
intermediate+ java developers I'd imagine.
I am willing to work on this but not sure where I should start / get feedback on designs etc. Unfortunately it looks like the original owner library is not very active.