Skip to content

Instantly share code, notes, and snippets.

Created March 9, 2013 14:55
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Java8で実行時にメソッドの引数の名前がとれるかんじ。 とか。 とか。
import java.lang.reflect.Method;
import java.util.Arrays;
public class ParameterNameExample {
public static void main(String... args) {
Class<ParameterNameExample> clz = ParameterNameExample.class; -> m.getName().startsWith("method"))
.map(m -> m.getName() + Arrays.toString(m.getParameters()))
public void method1(String hoge) {
public void method2(Object fuga, Object piyo) {
$ java8c
$ java8 ParameterNameExample
method1[ java.lang.String arg0]
method2[ java.lang.Object arg0, java.lang.Object arg1]
$ java8c -parameters
$ java8 ParameterNameExample
method2[ java.lang.Object fuga, java.lang.Object piyo]
method1[ java.lang.String hoge]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment