Java Reference
In-Depth Information
meterized type is returned as the
Class
object for the corresponding raw
type.
Given all the different kinds of types there are, some methods only apply
to a subset of those different kinds:
public Class<?>
getComponentType()
Returns the
Class
object representing the component type of
the array represented by this
Class
object. If this
Class
object
doesn't represent an array,
null
is returned. For example, giv-
en an array of
int
, the
getClass
method will return a
Class
ob-
ject for which
isArray
returns
TRue
and whose
getComponentType
method returns the same object as
int.class
.
public T[]
getEnumConstants()
Returns the elements of this enum class, or
null
if this
Class
object does not represent an enum.
public Class<?>
getdeclaringClass()
Returns the
Class
object for the type in which this nested type
was declared as a
member.
If this type is not a nested mem-
ber type,
null
is returned. For example, when invoked on a
local inner class or an anonymous inner class, this method re-
turns
null
.
public Class<?>
getEnclosingClass()
Returns the
Class
object for the enclosing type in which this
type was declared. If this type is a top-level type,
null
is re-
turned.
public Constructor<?>
getEnclosingConstructor()