package com.test;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
public class TestMain {
public void MyTestParamAnnotation(@Param("myname") String name,int id) {
System.out.println(name);
}
public static void main(String[] args) {
Class clsss = TestMain.class;
Method[] clsssMethods = clsss.getMethods();
for (Method method : clsssMethods) {
System.out.println("方法名:"+method.getName());
Annotation[][] annotations=method.getParameterAnnotations();
for(Annotation[] annotation:annotations){
if(annotation.length>0){
System.out.println(annotation[0].annotationType());
}
}
}
}
}
请问如何获得
@Param("myname")
中的myname值?