2

Is there a way to fetch parameter names of Interfaces from compiled source at runtime?

Use case: I am creating some proxy instances based on some interfaces. I need to get parameter names to create some SQL statements.

Any help?

Cemo
  • 5,370
  • 10
  • 50
  • 82
  • 1
    Read here: http://stackoverflow.com/questions/2237803/can-i-obtain-method-parameter-name-using-java-reflection – PeterMmm Apr 04 '14 at 12:13
  • @PeterMmm could you point which part I need to read? I had already read but I might be missing something. The question is related to class. – Cemo Apr 04 '14 at 12:16
  • In this case it is the same for class + interface methods. Cleanest thing is to use annotations. – PeterMmm Apr 04 '14 at 12:17

1 Answers1

1

Since Java SE 8, this is possible if you compiled your interfaces with the -parameters option:

http://docs.oracle.com/javase/tutorial/reflect/member/methodparameterreflection.html

Puce
  • 37,247
  • 13
  • 80
  • 152