AccessibleObject - JRE Emulation | JRE Emulation
public class

AccessibleObject

extends Object
implements AnnotatedElement
java.lang.Object
   ↳ java.lang.reflect.AccessibleObject
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Stub implementation of AccessibleObject. The actual implementation is in AccessibleObject.h and AccessibleObject.m, so the declared methods in this class should match the actual methods implemented in order to catch unsupported API references.

See Also

Summary

Public Constructors
AccessibleObject()
Public Methods
<T extends Annotation> T getAnnotation(Class<T> annotationClass)
Returns this element's annotation for the specified type if such an annotation is present, else null.
Annotation[] getAnnotations()
Returns annotations that are present on this element.
Annotation[] getDeclaredAnnotations()
Returns annotations that are directly present on this element.
boolean isAccessible()
boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
Returns true if an annotation for the specified type is present on this element, else false.
void setAccessible(boolean b)
static void setAccessible(AccessibleObject[] objects, boolean b)
Inherited Methods
[Expand]
From class java.lang.Object
From interface java.lang.reflect.AnnotatedElement

Public Constructors

public AccessibleObject ()

Public Methods

public T getAnnotation (Class<T> annotationClass)

Returns this element's annotation for the specified type if such an annotation is present, else null.

Parameters
annotationClass the Class object corresponding to the annotation type
Returns
  • this element's annotation for the specified annotation type if present on this element, else null

public Annotation[] getAnnotations ()

Returns annotations that are present on this element. If there are no annotations present on this element, the return value is an array of length 0. The caller of this method is free to modify the returned array; it will have no effect on the arrays returned to other callers.

Returns
  • annotations present on this element

public Annotation[] getDeclaredAnnotations ()

Returns annotations that are directly present on this element. This method ignores inherited annotations. If there are no annotations directly present on this element, the return value is an array of length 0. The caller of this method is free to modify the returned array; it will have no effect on the arrays returned to other callers.

Returns
  • annotations directly present on this element

public boolean isAccessible ()

public boolean isAnnotationPresent (Class<? extends Annotation> annotationClass)

Returns true if an annotation for the specified type is present on this element, else false. This method is designed primarily for convenient access to marker annotations.

The truth value returned by this method is equivalent to: getAnnotation(annotationClass) != null

The body of the default method is specified to be the code above.

Parameters
annotationClass the Class object corresponding to the annotation type
Returns
  • true if an annotation for the specified annotation type is present on this element, else false

public void setAccessible (boolean b)

public static void setAccessible (AccessibleObject[] objects, boolean b)