public booleanisPrimitive()
Returns true if this Class object is one of the Class objects representing
the eight primitive types or void.
public booleanisSynthetic()
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 construct in the source code.
public intgetModifiers()
Returns the modifiers for the type, encoded as an integer. The value should
be decoded using the constants and methods of class Modifier; see Section
16.3 on page 416. Type modifiers 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.
Primitive 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 modifier 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 booleanisMemberClass()
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.
public booleanisLocalClass()
Returns true if this class represents a local inner class.
public booleanisAnonymousClass()
Returns true if this class represents an anonymous inner class.
Note that there is no way to determine if a member class is a static nested class or an inner class.
The example showed the two methods you can use to find out where a type fits in the type hierarchy:
public Type[]getGenericInterfaces()
Returns an array of Type objects for each of the interfaces implemented by
this type. If no interfaces are implemented you will get a zero-length array. If
an implemented interface is a parameterized type, then the Type object will
be an instance of ParameterizedType; otherwise, the Type object will
be a Class object.
public TypegetGenericSuperclass()