Java 8 has the ability to acquire method parameter names using Reflection API.
How can I get these method parameter names?
As per my knowled
You can use Paranamer lib (https://github.com/paul-hammant/paranamer)
Sample code that works for me:
import com.thoughtworks.paranamer.AnnotationParanamer;
import com.thoughtworks.paranamer.BytecodeReadingParanamer;
import com.thoughtworks.paranamer.CachingParanamer;
import com.thoughtworks.paranamer.Paranamer;
Paranamer info = new CachingParanamer(new AnnotationParanamer(new BytecodeReadingParanamer()));
Method method = Foo.class.getMethod(...);
String[] parameterNames = info.lookupParameterNames(method);
If you use Maven then put this dependency in your pom.xml:
com.thoughtworks.paranamer
paranamer
2.8