I’m writing small and very DRY framework, which heavily relies on metadata. I’d like to know if there is a way to obtain method parameter names, i.e. given some method
public void a(int myIntParam, String theString) { ... }
get the strings 'myIntParam' and 'theString'.
I know I could annotate parameters, but that wouldn’t be nice…
public void a( @Param('myIntParam') int myIntParam, @Param('theString') String theString ) { ... }
We created a custom annotation for the method that holds a String[] of parameter names. This approach felt a little easier to manage than having to annotate each individual parameter. We plan to add build-time checking that the number of annotated parameter names matches the number of arguments, since that it what we require.