java.lang.Object | |
↳ | java.lang.reflect.AccessibleObject |
Known Direct Subclasses
|
AccessibleObject
is the superclass of all member reflection classes
(Field, Constructor, Method). AccessibleObject provides the ability to toggle
a flag controlling access checks for these objects. By default, accessing a
member (for example, setting a field or invoking a method) checks the
validity of the access (for example, invoking a private method from outside
the defining class is prohibited) and throws IllegalAccessException if the
operation is not permitted. If the accessible flag is set to true, these
checks are omitted. This allows privileged code, such as Java object
serialization, object inspectors, and debuggers to have complete access to
objects.
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Constructs a new
AccessibleObject
instance.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Returns, for this element, the annotation with the specified type, or
null
if no annotation with the specified type is present
(including inherited annotations).
|
||||||||||
|
Returns, for this element, an array containing all annotations (including
inherited annotations).
|
||||||||||
|
Returns, for this element, all annotations that are explicitly declared
(not inherited).
|
||||||||||
|
Indicates whether this object is accessible without access checks being
performed.
|
||||||||||
|
Indicates whether or not this element has an annotation with the
specified annotation type (including inherited annotations).
|
||||||||||
|
Attempts to set the value of the accessible flag.
|
||||||||||
|
Attempts to set the value of the accessible flag for all the objects in
the array provided.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
|||||||||||
From interface
java.lang.reflect.AnnotatedElement
|
Constructs a new
AccessibleObject
instance.
AccessibleObject
instances can only be constructed by the virtual
machine.
Returns, for this element, the annotation with the specified type, or
null
if no annotation with the specified type is present
(including inherited annotations).
annotationType | the type of the annotation to search for |
---|
null
Returns, for this element, an array containing all annotations (including inherited annotations). If there are no annotations present, this method returns a zero length array.
Returns, for this element, all annotations that are explicitly declared (not inherited). If there are no declared annotations present, this method returns a zero length array.
Indicates whether this object is accessible without access checks being performed. Returns the accessible flag.
true
if this object is accessible without access
checks,
false
otherwise
Indicates whether or not this element has an annotation with the specified annotation type (including inherited annotations).
annotationType | the type of the annotation to search for |
---|
true
if the annotation exists,
false
otherwise
Attempts to set the value of the accessible flag. Setting this flag to
false
will enable access checks, setting to
true
will
disable them.
flag | the new value for the accessible flag |
---|
Attempts to set the value of the accessible flag for all the objects in
the array provided. Setting this
flag to
false
will enable access checks, setting to
true
will disable them.
objects | the accessible objects |
---|---|
flag | the new value for the accessible flag |