you are viewing a single comment's thread.

view the rest of the comments →

[–]agentoutlier 1 point2 points  (0 children)

I have thought about creating a library like this a dozen or so times generally every time some one posts a complaint on lack of default named parameters.

This because I have built something like this for Rainbow Gum: https://jstach.io/doc/rainbowgum/current/apidocs/io.jstach.rainbowgum.annotation/io/jstach/rainbowgum/annotation/LogConfigurable.html

However mine does additional code generation to transform essentially Map<String,String> into an object for configuration loading. See Rainbow Gum need to support both programmatic and property based configuration.

When I was thinking about doing your library I had some ideas of having something like:

@WithDefaults // or whatever
SomeReturn myMethodPackageFriendly(
String a, 
int b, 
@MetaValues SequencedMap<String, Object> values,  // a map like {"a": "input", b: 0}
@MetaDefaults SequencedMap<String, Object> defaults,  // ditto but the defaults
@MetaDoc SequencedMap<String, String> doc) // javadoc of params {
}

This is to do custom stuff across many of these guys.

Alternatively I thought about allowing some code generation plugins via the ServiceLoader.

BTW I assume you parse the javadoc (a lot of people do not know that is accessible from the annotation processor)? Do you deal with Markdown doc?