public static void main(String[] args) {
Method[] methods = SampleClass.class.getMethods();
- Type[] parameters = methods[3].getGenericParameterTypes();
+ // Method[] methods = Class.class.getMethods();
+ Method method = null;
+ for(Method meth : methods) {
+ if (meth.getName().equals("setSampleField")) {
+ method = meth;
+ }
+ }
+ Type[] parameters = method.getGenericParameterTypes();
//Type[] parameters = methods[0].getGenericParameterTypes();
for (int i = 0; i < parameters.length; i++) {
System.out.println(parameters[i]);
}
System.out.println();*/
- TypeVariable[] typeParameters = Generic.class.getTypeParameters();
+ /*TypeVariable[] typeParameters = Generic.class.getTypeParameters();
//TypeVariable[] typeParameters = SampleClass.class.getTypeParameters();
for(TypeVariable typeVar: typeParameters){
System.out.println(typeVar);
System.out.println();
Type returnType = methods[0].getGenericReturnType();
System.out.println(returnType);
-
+ */
}
}