Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java code generation for config interfaces #33

Open
AarjavP opened this issue Jun 7, 2017 · 0 comments
Open

Java code generation for config interfaces #33

AarjavP opened this issue Jun 7, 2017 · 0 comments
Labels
Intermediate Projects that require a medium level of understanding. Doesn't require much prior knowledge. Medium work This project takes little time to complete. (ETA week or two)

Comments

@AarjavP
Copy link

AarjavP commented Jun 7, 2017

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.

@FredrikAugust FredrikAugust added Intermediate Projects that require a medium level of understanding. Doesn't require much prior knowledge. Medium work This project takes little time to complete. (ETA week or two) labels Oct 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Intermediate Projects that require a medium level of understanding. Doesn't require much prior knowledge. Medium work This project takes little time to complete. (ETA week or two)
Projects
None yet
Development

No branches or pull requests

2 participants