Class JClassType

public class JClassType
extends JType
implements HasMetaData
Type representing a Java class or interface type.

Constructors

JClassType(TypeOracle, CompilationUnitProvider, JPackage, JClassType, boolean, String, int, int, int, int, boolean)

Methods

addImplementedInterface(JClassType)
addMetaData(String, String[])Adds additional metadata.
addModifierBits(int)
findConstructor(JType[])
findField(String)
findMethod(String, JType[])
findNestedType(String)
getBodyEnd()
getBodyStart()
getCompilationUnit()
getConstructor(JType[])
getConstructors()
getEnclosingType()
getField(String)
getFields()
getImplementedInterfaces()
getJNISignature()
getMetaData(String)Gets each list of metadata for the specified tag name.
getMetaDataTags()Gets the name of available metadata tags.
getMethod(String, JType[])
getMethods()
getModifierBits()
getName()
getNestedType(String)
getNestedTypes()
getOracle()
getOverloads(String)
getOverridableMethods()Iterates over the most-derived declaration of each unique overridable method available in the type hierarchy of the specified type, including those found in superclasses and superinterfaces.
getPackage()
getQualifiedSourceName()
getSimpleSourceName()
getSubtypes()
getSuperclass()
getTypeHash()
isAbstract()
isArray()
isAssignableFrom(JClassType)
isAssignableTo(JClassType)
isClass()
isDefaultInstantiable()Determines if the class can be constructed using a simple new operation.
isInterface()
isLocalType()Tests if this type is a local type (within a method).
isMemberType()Tests if this type is contained within another type.
isParameterized()
isPrimitive()
isPrivate()
isProtected()
isPublic()
isStatic()
setSuperclass(JClassType)
toString()

Constructor Detail

JClassType

public JClassType(TypeOracle oracle, CompilationUnitProvider cup, JPackage declaringPackage, JClassType enclosingType, boolean isLocalType, String name, int declStart, int declEnd, int bodyStart, int bodyEnd, boolean isInterface)

Parameters

oracle
cup
declaringPackage
enclosingType
isLocalType
name
declStart
declEnd
bodyStart
bodyEnd
isInterface

Method Detail

addImplementedInterface

public void addImplementedInterface(JClassType intf)

Parameters

intf

addMetaData

public void addMetaData(String tagName, String[] values)
Adds additional metadata.

Parameters

tagName
values

addModifierBits

public void addModifierBits(int bits)

Parameters

bits

findConstructor

public JConstructor findConstructor(JType[] paramTypes)

Parameters

paramTypes

findField

public JField findField(String name)

Parameters

name

findMethod

public JMethod findMethod(String name, JType[] paramTypes)

Parameters

name
paramTypes

findNestedType

public JClassType findNestedType(String typeName)

Parameters

typeName

getBodyEnd

public int getBodyEnd()

getBodyStart

public int getBodyStart()

getCompilationUnit

public CompilationUnitProvider getCompilationUnit()

getConstructor

public JConstructor getConstructor(JType[] paramTypes)
     throws NotFoundException

Parameters

paramTypes

getConstructors

public JConstructor[] getConstructors()

getEnclosingType

public JClassType getEnclosingType()

getField

public JField getField(String name)

Parameters

name

getFields

public JField[] getFields()

getImplementedInterfaces

public JClassType[] getImplementedInterfaces()

getJNISignature

public abstract String getJNISignature()

getMetaData

public String[][] getMetaData(String tagName)
Gets each list of metadata for the specified tag name.

Parameters

tagName

getMetaDataTags

public String[] getMetaDataTags()
Gets the name of available metadata tags.

getMethod

public JMethod getMethod(String name, JType[] paramTypes)
     throws NotFoundException

Parameters

name
paramTypes

getMethods

public JMethod[] getMethods()

getModifierBits

protected int getModifierBits()

getName

public String getName()

getNestedType

public JClassType getNestedType(String typeName)
     throws NotFoundException

Parameters

typeName

getNestedTypes

public JClassType[] getNestedTypes()

getOracle

public TypeOracle getOracle()

getOverloads

public JMethod[] getOverloads(String name)

Parameters

name

getOverridableMethods

public JMethod[] getOverridableMethods()
Iterates over the most-derived declaration of each unique overridable method available in the type hierarchy of the specified type, including those found in superclasses and superinterfaces. A method is overridable if it is not final and its accessibility is public, protected, or package protected. Deferred binding generators often need to generate method implementations; this method offers a convenient way to find candidate methods to implement. Note that the behavior does not match Class.getMethod(String, Class[]), which does not return the most derived method in some cases.

Return Value

an array of JMethod objects representing overridable methods

getPackage

public JPackage getPackage()

getQualifiedSourceName

public abstract String getQualifiedSourceName()

getSimpleSourceName

public abstract String getSimpleSourceName()

getSubtypes

public JClassType[] getSubtypes()

getSuperclass

public JClassType getSuperclass()

getTypeHash

public String getTypeHash()
     throws UnableToCompleteException

isAbstract

public boolean isAbstract()

isArray

public abstract JArrayType isArray()

isAssignableFrom

public boolean isAssignableFrom(JClassType possibleSubtype)

Parameters

possibleSubtype

isAssignableTo

public boolean isAssignableTo(JClassType possibleSupertype)

Parameters

possibleSupertype

isClass

public abstract JClassType isClass()

isDefaultInstantiable

public boolean isDefaultInstantiable()
Determines if the class can be constructed using a simple new operation. Specifically, the class must

Return Value

true if the type is default instantiable, or false otherwise

isInterface

public abstract JClassType isInterface()

isLocalType

public boolean isLocalType()
Tests if this type is a local type (within a method).

Return Value

true if this type is a local type, whether it is named or anonymous.

isMemberType

public boolean isMemberType()
Tests if this type is contained within another type.

Return Value

true if this type has an enclosing type, false if this type is a top-level type

isParameterized

public abstract JParameterizedType isParameterized()

isPrimitive

public abstract JPrimitiveType isPrimitive()

isPrivate

public boolean isPrivate()

isProtected

public boolean isProtected()

isPublic

public boolean isPublic()

isStatic

public boolean isStatic()

setSuperclass

public void setSuperclass(JClassType type)

Parameters

type

toString

public String toString()