annotation

package com.gelc.annotation.demo.reflect;
import java.lang.annotation.Annotation;=
import java.lang.reflect.Method;
public class AnnotationIntro {
public static void main(String[] args) throws Exception {
Method[] methods = Class.forName("com.gelc.annotation.demo.customize.AnnotationTest").getDeclaredMethods();
Annotation[] annotations;
for (Method method : methods) {
annotations = method.getAnnotations();
for (Annotation annotation : annotations) {
System.out.println(method.getName() + " : " + annotation.annotationType().getName());
}
}
}
}
發佈了25 篇原創文章 · 獲贊 0 · 訪問量 934
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章