package com.logicbig.example.method;
import java.lang.reflect.Method;
public class ToGenericStringExample {
private static void myMethod(String arg){}
public static void main(String... args) throws NoSuchMethodException {
Method m = ToGenericStringExample.class.getDeclaredMethod("myMethod", String.class);
String s = m.toGenericString();
System.out.println(s);
}
}
Output
private static void com.logicbig.example.method.ToGenericStringExample.myMethod(java.lang.String)
package com.logicbig.example.method;
import java.lang.reflect.Method;
public class ToGenericStringExample2 {
enum MyEnum {A, B}
public static void main(String... args) {
for (Method method : MyEnum.class.getDeclaredMethods()) {
System.out.println(method.toGenericString());
}
}
}
Output
public static com.logicbig.example.method.ToGenericStringExample2$MyEnum[] com.logicbig.example.method.ToGenericStringExample2$MyEnum.values()
public static com.logicbig.example.method.ToGenericStringExample2$MyEnum com.logicbig.example.method.ToGenericStringExample2$MyEnum.valueOf(java.lang.String)