【註解工具類】AnnotationUtils

這裏使用的是:3.9 的版本,還是比較新的

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
     <version>3.9</version>
</dependency>

 

isValidAnnotationMemberType(Class<?> type) 檢測是否爲有效的類型()  基本類型、枚舉、註解、封裝的String、Class

AnnotationUtils.isValidAnnotationMemberType(short.class); // 基本類型 true
AnnotationUtils.isValidAnnotationMemberType(SuppressWarnings.class); // 註解類型 true
AnnotationUtils.isValidAnnotationMemberType(ElementType.class); // ElementType(枚舉類型) true
AnnotationUtils.isValidAnnotationMemberType(QcTemplate.class); // 其它引用類型 false

 

就一個公共方法 ...

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章