Conversation
|
I've now started to look into this and pushed some initial implementation that includes:
Of course, there is still a lot missing, and even the pieces I did are only for the most basic cases, so I need to start looking into all the edge cases, but it is a start. In terms of the API, I think we could start with something smaller and drop On another note, interface Server {
String host();
int port();
}
Server server = forInterface(Server.class)
.with(Server::host, "localhost")
.with(Server::port, 8080)
.build();So, |
This is caused by using a type variable in the first argument, which I believe prevents inferencing due to some complexity aspect. I recommend creating a custom interface type for each type of property which also implements |
|
@dmlloyd I think this is ready for a first version:
I've removed the Let me know what you think. |
|
Seems OK. Don't forget to JavaDoc the rest of the API. |
- Builder class generation - Simple leaf types and primitives - Simple optionals - @WithDefault
- Builder class generation - Leaf types and primitives - Optionals - Maps - Collections - @WithDefault
- Optional Group - Map with Collections - Default methods
- Remove unused methods from ConfigInstanceBuilder - Share the same code between ConfigInstanceBuilder and ConfigMappingContext - Simplify ConfigMappingGenerator
Update: there is now a basic (but incomplete) implementation.
This is a first draft of the builder API for constructing configuration instances. No implementation is included yet; this is just for API review.
Fixes #1001.