accessibleobjectaccessibleobject
Convenience method to set the accessible flag for an array of objects with a single security check (for efficiency).
First, if there is a security manager, its checkPermission method is called with a ReflectPermission("suppressAccessChecks") permission.
A SecurityException is raised if flag is true but accessibility of any of the elements of the input array may not be changed (for example, if the element object is a Constructor object for the class Class). In the event of such a SecurityException, the accessibility of objects is set to flag for array elements upto (and excluding) the element for which the exception occurred; the accessibility of elements beyond (and including) the element for which the exception occurred is unchanged.
public void setAccessible(boolean flag)
throws SecurityException
Set the accessible flag for this object to the indicated boolean value. A value of true indicates that the reflected object should suppress Java language access checking when it is used. A value of false indicates that the reflected object should enforce Java language access checks.
First, if there is a security manager, its checkPermission method is called with a ReflectPermission("suppressAccessChecks") permission.
A SecurityException is raised if flag is true but accessibility of this object may not be changed (for example, if this element object is a Constructor object for the class Class).
A SecurityException is raised if this object is a Constructor object for the class java.lang.Class, and flag is true.
public boolean isAccessible()
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
public Annotation[] getAnnotations()
public Annotation[] getDeclaredAnnotations()
Returns all annotations that are directly present on this element. Unlike the other methods in this intece, this method ignores inherited annotations. (Returns an array of length zero if no annotations are directly present on this element.) The caller of this method is free to modify the returned array; it will have no effect on the arrays returned to other callers.
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-49307-1.html
在叙利亚丢了面子