polyglot.types
Interface ClassType

All Superinterfaces:
java.lang.Cloneable, Copy, Importable, MemberInstance, Named, Qualifier, ReferenceType, java.io.Serializable, Type, TypeObject
All Known Subinterfaces:
CofferClassType, CofferParsedClassType, CofferSubstType, ParsedClassType
All Known Implementing Classes:
ClassType_c, CofferParsedClassType_c, CofferSubstClassType_c, PaoParsedClassType_c, ParsedClassType_c, SubstClassType_c

public interface ClassType
extends Importable, ReferenceType, MemberInstance

A 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.


Nested Class Summary
static class ClassType.Kind
           
 
Field Summary
static ClassType.Kind ANONYMOUS
           
static ClassType.Kind LOCAL
           
static ClassType.Kind MEMBER
           
static ClassType.Kind TOP_LEVEL
           
 
Method Summary
 java.util.List 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.
 java.util.List 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 if this is a nested class, or null.
 
Methods inherited from interface polyglot.types.Importable
package_
 
Methods inherited from interface polyglot.types.Named
fullName, name
 
Methods inherited from interface polyglot.types.ReferenceType
fields, hasMethod, hasMethodImpl, interfaces, methods, methods, methodsNamed, superType
 
Methods inherited from interface polyglot.types.Type
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, toArray, toClass, toNull, toPrimitive, toReference, toString, translate
 
Methods inherited from interface polyglot.types.Qualifier
isPackage, isType, toPackage, toType
 
Methods inherited from interface polyglot.types.MemberInstance
container, flags
 

Field Detail

TOP_LEVEL

static final ClassType.Kind TOP_LEVEL

MEMBER

static final ClassType.Kind MEMBER

LOCAL

static final ClassType.Kind LOCAL

ANONYMOUS

static final ClassType.Kind ANONYMOUS
Method Detail

kind

ClassType.Kind kind()
Get the class's kind.


isTopLevel

boolean isTopLevel()
Return true if the class is top-level (i.e., not inner). Equivalent to kind() == TOP_LEVEL.


isInner

boolean isInner()
Deprecated. Was incorrectly defined. Use isNested for nested classes, and isInnerClass for inner classes.

Return true if the class is an inner class. Equivalent to kind() == MEMBER || kind() == LOCAL || kind() == ANONYMOUS.


isNested

boolean isNested()
Return true if the class is a nested. Equivalent to kind() == MEMBER || kind() == LOCAL || kind() == ANONYMOUS.


isInnerClass

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.


isMember

boolean isMember()
Return true if the class is a member class. Equivalent to kind() == MEMBER.


isLocal

boolean isLocal()
Return true if the class is a local class. Equivalent to kind() == LOCAL.


isAnonymous

boolean isAnonymous()
Return true if the class is an anonymous class. Equivalent to kind() == ANONYMOUS.


inStaticContext

boolean inStaticContext()
Return true if the class declaration occurs in a static context. Is used to determine if a nested class is implicitly static.


constructors

java.util.List constructors()
The class's constructors. A list of ConstructorInstance.

See Also:
ConstructorInstance

memberClasses

java.util.List memberClasses()
The class's member classes. A list of ClassType.

See Also:
ClassType

memberClassNamed

ClassType memberClassNamed(java.lang.String name)
Returns the member class with the given name, or null.


fieldNamed

FieldInstance fieldNamed(java.lang.String name)
Get a field by name, or null.

Specified by:
fieldNamed in interface ReferenceType

isEnclosed

boolean isEnclosed(ClassType outer)
Return true if the class is strictly contained in outer.


isEnclosedImpl

boolean isEnclosedImpl(ClassType outer)
Implementation of isEnclosed. This method should only be called by the TypeSystem or by a subclass.


hasEnclosingInstance

boolean hasEnclosingInstance(ClassType encl)
Return true if an object of the class has an enclosing instance of encl.


hasEnclosingInstanceImpl

boolean hasEnclosingInstanceImpl(ClassType encl)
Implementation of hasEnclosingInstance. This method should only be called by the TypeSystem or by a subclass.


outer

ClassType outer()
The class's outer class if this is a nested class, or null.