public interface ClassType extends Importable, ReferenceType, MemberInstance, Declaration
ClassType
represents a class, either loaded from a
classpath, parsed from a source file, or obtained from other source.
A ClassType
is not necessarily named.Modifier and Type | Interface and Description |
---|---|
static class |
ClassType.Kind |
Modifier and Type | Field and Description |
---|---|
static ClassType.Kind |
ANONYMOUS |
static ClassType.Kind |
LOCAL |
static ClassType.Kind |
MEMBER |
static ClassType.Kind |
TOP_LEVEL |
Modifier and Type | Method and Description |
---|---|
java.util.List<? extends ConstructorInstance> |
constructors()
The class's constructors.
|
FieldInstance |
fieldNamed(java.lang.String name)
Get a field by name, or null.
|
boolean |
hasEnclosingInstance(ClassType encl)
Return true if an object of the class has
an enclosing instance of
encl . |
boolean |
hasEnclosingInstanceImpl(ClassType encl)
Implementation of
hasEnclosingInstance . |
boolean |
inStaticContext()
Return true if the class declaration occurs in a static context.
|
boolean |
isAnonymous()
Return true if the class is an anonymous class.
|
boolean |
isEnclosed(ClassType outer)
Return true if the class is strictly contained in
outer . |
boolean |
isEnclosedImpl(ClassType outer)
Implementation of
isEnclosed . |
boolean |
isInner()
Deprecated.
Was incorrectly defined. Use isNested for nested classes,
and isInnerClass for inner classes.
|
boolean |
isInnerClass()
Return true if the class is an inner class, that is, it is a nested
class that is not explicitly or implicitly declared static; an interface
is never an inner class.
|
boolean |
isLocal()
Return true if the class is a local class.
|
boolean |
isMember()
Return true if the class is a member class.
|
boolean |
isNested()
Return true if the class is a nested.
|
boolean |
isTopLevel()
Return true if the class is top-level (i.e., not inner).
|
ClassType.Kind |
kind()
Get the class's kind: top-level, member, local, or anonymous.
|
java.util.List<? extends ClassType> |
memberClasses()
The class's member classes.
|
ClassType |
memberClassNamed(java.lang.String name)
Returns the member class with the given name, or null.
|
ClassType |
outer()
The class's outer class, or null if a top-level class.
|
Resolver |
resolver()
A resolver to access member classes of the class.
|
package_
fields, hasMethod, hasMethodImpl, interfaces, members, methods, methods, methodsNamed, superType
arrayOf, arrayOf, descendsFrom, descendsFromImpl, isArray, isBoolean, isByte, isCastValid, isCastValidImpl, isChar, isClass, isComparable, isDouble, isFloat, isImplicitCastValid, isImplicitCastValidImpl, isInt, isIntOrLess, isLong, isLongOrLess, isNull, isNumeric, isPrimitive, isReference, isShort, isSubtype, isSubtypeImpl, isThrowable, isUncheckedException, isVoid, numericConversionValid, numericConversionValid, numericConversionValidImpl, numericConversionValidImpl, print, toArray, toClass, toNull, toPrimitive, toReference, toString, translate, typeEquals, typeEqualsImpl
equalsImpl, isCanonical, position, typeSystem
container, flags, setContainer, setFlags
declaration, setDeclaration
static final ClassType.Kind TOP_LEVEL
static final ClassType.Kind MEMBER
static final ClassType.Kind LOCAL
static final ClassType.Kind ANONYMOUS
Resolver resolver()
ClassType.Kind kind()
boolean isTopLevel()
@Deprecated boolean isInner()
boolean isNested()
boolean isInnerClass()
boolean isMember()
boolean isLocal()
boolean isAnonymous()
boolean inStaticContext()
java.util.List<? extends ConstructorInstance> constructors()
ConstructorInstance
.ConstructorInstance
java.util.List<? extends ClassType> memberClasses()
ClassType
.ClassType
ClassType memberClassNamed(java.lang.String name)
FieldInstance fieldNamed(java.lang.String name)
fieldNamed
in interface ReferenceType
boolean isEnclosed(ClassType outer)
outer
.boolean isEnclosedImpl(ClassType outer)
isEnclosed
.
This method should only be called by the TypeSystem
or by a subclass.boolean hasEnclosingInstance(ClassType encl)
encl
.boolean hasEnclosingInstanceImpl(ClassType encl)
hasEnclosingInstance
.
This method should only be called by the TypeSystem
or by a subclass.ClassType outer()