Java Reference
In-Depth Information
public boolean
isPrimitive()
Returns
true
if this
Class
object is one of the
Class
objects rep-
resenting the eight primitive types or
void
.
public boolean
isSynthetic()
Returns
TRue
if this
Class
object represents a synthetic type
introduced by the compiler. A synthetic program element is
anything for which there does not exist a corresponding con-
struct in the source code.
public int
getModifiers()
Returns the modifiers for the type, encoded as an integer. The
value should be decoded using the constants and methods of
ers include the access modifiers (
public
,
protected
,
private
) as
well as
abstract
,
final
, and
static
. For convenience, whether
a type is an interface is also encoded as a modifier. Primit-
ive types are always
public
and
final
. Array types are always
final
and have the same access modifier as their component
type. In this context, an annotation is not considered a mod-
ifier because this encoding scheme pre-dates the addition of
annotations to the language.
You can also ask whether you have a top-level type or a nested type,
and if nested, some information about which kind of nested type:
public boolean
isMemberClass()
Returns
true
if this
Class
object represents a type that is a
member of another typethat is, it is a nested type. If this
method returns
false
, then you have a top-level type. Despite
the name, this method applies to nested interfaces, as well as
nested classes.