介紹
java.lang.reflect.AccessibleObject
public class AccessibleObject implements AnnotatedElement
- Field 、 Method和Constructor對象(稱爲反射對象)的基類
API
static
- setAccessible
- 爲一組反射對象設置可訪問標誌
- 用於設置反射對象的訪問權限,使得私有屬性和方法也可以被訪問和執行
public
- setAccessible
- 將此反射對象設置爲可訪問
- trySetAccessible
- 如果可能,將此反射對象的accessible標誌設置爲true 。此方法設置accessible標誌,就像通過調用
setAccessible(true)
一樣,並返回可accessible標誌的可能更新值。如果無法啓用訪問,即無法抑制檢查或 Java 語言訪問控制,則此方法返回false
- 如果可能,將此反射對象的accessible標誌設置爲true 。此方法設置accessible標誌,就像通過調用
- canAccess
- 測試調用者是否可以訪問此反射對象
java.lang.reflect.AnnotatedElement
- getAnnotation
- isAnnotationPresent
- getAnnotationsByType
- getAnnotations
- getDeclaredAnnotation
- getDeclaredAnnotationsByType
- getDeclaredAnnotations