0

I am using MethodHandle of java 7 to set/get attribute value of a POJO class(instead of conventional getters and setters). I am using MethodHandle.invoke() for the same.

My application needs to know the attribute name associated with the above invocation.

Is there a way to get the attribute name involved with the MethodHandle.

If it is of type Method then it is possible with reflection. But can anyone tell me how to do the same in MethodHandle.

  • Possible duplicate of [Using reflection to get method name and parameters](http://stackoverflow.com/questions/471693/using-reflection-to-get-method-name-and-parameters) – Andremoniy Dec 22 '15 at 12:00
  • @Andremoniy Note that, with Java 8, [it is possible to determine the parameter names](http://stackoverflow.com/questions/21455403/how-to-get-method-parameter-names-in-java-8-using-reflection/21455958#21455958) if specific preconditions are met. – Andreas Fester Dec 22 '15 at 12:12
  • 1
    answer is no at runtime : http://stackoverflow.com/questions/2237803/can-i-obtain-method-parameter-name-using-java-reflection – guillaume girod-vitouchkina Dec 22 '15 at 12:59

0 Answers0