GWT 2.1.1

com.google.gwt.core.ext.typeinfo
Class JClassType

java.lang.Object
  extended by com.google.gwt.core.ext.typeinfo.JType
      extended by com.google.gwt.core.ext.typeinfo.JClassType
All Implemented Interfaces:
HasAnnotations, HasMetaData
Direct Known Subclasses:
JArrayType, JParameterizedType, JRawType, JRealClassType, JTypeParameter, JWildcardType

public abstract class JClassType
extends JType
implements HasAnnotations, HasMetaData

Type used to represent any non-primitive type.


Constructor Summary
JClassType()
           
 
Method Summary
protected abstract  void acceptSubtype(JClassType me)
           
 JParameterizedType asParameterizationOf(JGenericType type)
           
<T extends java.lang.annotation.Annotation>
T
findAnnotationInTypeHierarchy(java.lang.Class<T> annotationType)
          Find an annotation on a type or on one of its superclasses or superinterfaces.
abstract  JConstructor findConstructor(JType[] paramTypes)
           
abstract  JField findField(java.lang.String name)
           
abstract  JMethod findMethod(java.lang.String name, JType[] paramTypes)
           
abstract  JClassType findNestedType(java.lang.String typeName)
           
abstract
<T extends java.lang.annotation.Annotation>
T
getAnnotation(java.lang.Class<T> annotationClass)
          Returns an instance of the specified annotation type if it is present on this element or null if it is not.
abstract  JConstructor getConstructor(JType[] paramTypes)
           
abstract  JConstructor[] getConstructors()
           
abstract  JClassType getEnclosingType()
           
abstract  JClassType getErasedType()
           
abstract  JField getField(java.lang.String name)
           
abstract  JField[] getFields()
           
 java.util.Set<JClassType> getFlattenedSupertypeHierarchy()
          Returns all of the superclasses and superinterfaces for a given type including the type itself.
protected static java.util.Set<JClassType> getFlattenedSuperTypeHierarchy(JClassType type)
          Returns all of the superclasses and superinterfaces for a given type including the type itself.
abstract  JClassType[] getImplementedInterfaces()
           
abstract  JMethod[] getInheritableMethods()
          Iterates over the most-derived declaration of each unique inheritable method available in the type hierarchy of the specified type, including those found in superclasses and superinterfaces.
protected abstract  void getInheritableMethodsOnSuperclassesAndThisClass(java.util.Map<java.lang.String,JMethod> methodsBySignature)
           
protected abstract  void getInheritableMethodsOnSuperinterfacesAndMaybeThisInterface(java.util.Map<java.lang.String,JMethod> methodsBySignature)
          Gets the methods declared in interfaces that this type extends.
 java.lang.String[][] getMetaData(java.lang.String tagName)
          Deprecated. 
 java.lang.String[] getMetaDataTags()
          Deprecated. 
abstract  JMethod getMethod(java.lang.String name, JType[] paramTypes)
           
abstract  JMethod[] getMethods()
           
protected abstract  int getModifierBits()
           
abstract  java.lang.String getName()
           
abstract  JClassType getNestedType(java.lang.String typeName)
           
abstract  JClassType[] getNestedTypes()
           
abstract  TypeOracle getOracle()
           
abstract  JMethod[] getOverloads(java.lang.String name)
           
abstract  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.
abstract  JPackage getPackage()
           
abstract  JClassType[] getSubtypes()
           
abstract  JClassType getSuperclass()
           
abstract  boolean isAbstract()
           
abstract  boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
          Returns true if this item has an annotation of the specified type.
 boolean isAssignableFrom(JClassType possibleSubtype)
          Returns true if this JClassType is assignable from the specified JClassType parameter.
 boolean isAssignableTo(JClassType possibleSupertype)
          Returns true if this JClassType is assignable to the specified JClassType parameter.
abstract  boolean isDefaultInstantiable()
          Determines if the class can be constructed using a simple new operation.
 boolean isEnhanced()
          Returns true if the type may be enhanced on the server to contain extra fields that are unknown to client code.
abstract  boolean isFinal()
           
abstract  JGenericType isGenericType()
           
abstract  JClassType isInterface()
           
 boolean isLocalType()
          Deprecated. local types are not modeled
protected  com.google.gwt.core.ext.typeinfo.JMaybeParameterizedType isMaybeParameterizedType()
           
abstract  boolean isMemberType()
          Tests if this type is contained within another type.
abstract  boolean isPrivate()
           
abstract  boolean isProtected()
           
abstract  boolean isPublic()
           
abstract  boolean isStatic()
           
protected abstract  void notifySuperTypesOf(JClassType me)
          Tells this type's superclasses and superinterfaces about it.
protected abstract  void removeSubtype(JClassType me)
           
 void setEnhanced()
          Indicates that the type may be enhanced on the server to contain extra fields that are unknown to client code.
 java.lang.String toString()
           
 
Methods inherited from class com.google.gwt.core.ext.typeinfo.JType
equals, getJNISignature, getLeafType, getParameterizedQualifiedSourceName, getQualifiedBinaryName, getQualifiedSourceName, getSimpleSourceName, hashCode, isAnnotation, isArray, isClass, isClassOrInterface, isEnum, isParameterized, isPrimitive, isRawType, isTypeParameter, isWildcard
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JClassType

public JClassType()
Method Detail

getFlattenedSuperTypeHierarchy

protected static java.util.Set<JClassType> getFlattenedSuperTypeHierarchy(JClassType type)
Returns all of the superclasses and superinterfaces for a given type including the type itself. The returned set maintains an internal breadth-first ordering of the type, followed by its interfaces (and their super-interfaces), then the supertype and its interfaces, and so on.


asParameterizationOf

public JParameterizedType asParameterizationOf(JGenericType type)

findAnnotationInTypeHierarchy

public <T extends java.lang.annotation.Annotation> T findAnnotationInTypeHierarchy(java.lang.Class<T> annotationType)
Find an annotation on a type or on one of its superclasses or superinterfaces.

This provides semantics similar to that of Inherited except that it checks all types to which this type is assignable. @Inherited only works on superclasses, not superinterfaces.

Annotations present on the superclass chain will be returned preferentially over those found in the superinterface hierarchy. Note that the annotation does not need to be tagged with @Inherited in order to be returned from the superclass chain.

Parameters:
annotationType - the type of the annotation to look for
Returns:
the desired annotation or null if the annotation is not present in the type's type hierarchy

findConstructor

public abstract JConstructor findConstructor(JType[] paramTypes)

findField

public abstract JField findField(java.lang.String name)

findMethod

public abstract JMethod findMethod(java.lang.String name,
                                   JType[] paramTypes)

findNestedType

public abstract JClassType findNestedType(java.lang.String typeName)

getAnnotation

public abstract <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> annotationClass)
Description copied from interface: HasAnnotations
Returns an instance of the specified annotation type if it is present on this element or null if it is not.

Specified by:
getAnnotation in interface HasAnnotations
Parameters:
annotationClass - annotation type to search for
Returns:
instance of the specified annotation type if it is present on this element or null if it is not

getConstructor

public abstract JConstructor getConstructor(JType[] paramTypes)
                                     throws NotFoundException
Throws:
NotFoundException

getConstructors

public abstract JConstructor[] getConstructors()

getEnclosingType

public abstract JClassType getEnclosingType()

getErasedType

public abstract JClassType getErasedType()
Specified by:
getErasedType in class JType

getField

public abstract JField getField(java.lang.String name)

getFields

public abstract JField[] getFields()

getFlattenedSupertypeHierarchy

public java.util.Set<JClassType> getFlattenedSupertypeHierarchy()
Returns all of the superclasses and superinterfaces for a given type including the type itself. The returned set maintains an internal breadth-first ordering of the type, followed by its interfaces (and their super-interfaces), then the supertype and its interfaces, and so on.


getImplementedInterfaces

public abstract JClassType[] getImplementedInterfaces()

getInheritableMethods

public abstract JMethod[] getInheritableMethods()
Iterates over the most-derived declaration of each unique inheritable method available in the type hierarchy of the specified type, including those found in superclasses and superinterfaces. A method is inheritable if its accessibility is public, protected, or package protected. This method offers a convenient way for Generators to find candidate methods to call from a subclass.

Returns:
an array of JMethod objects representing inheritable methods

getMetaData

@Deprecated
public final java.lang.String[][] getMetaData(java.lang.String tagName)
Deprecated. 

Description copied from interface: HasMetaData
Gets each list of metadata for the specified tag name.

Specified by:
getMetaData in interface HasMetaData

getMetaDataTags

@Deprecated
public final java.lang.String[] getMetaDataTags()
Deprecated. 

Description copied from interface: HasMetaData
Gets the name of available metadata tags.

Specified by:
getMetaDataTags in interface HasMetaData

getMethod

public abstract JMethod getMethod(java.lang.String name,
                                  JType[] paramTypes)
                           throws NotFoundException
Throws:
NotFoundException

getMethods

public abstract JMethod[] getMethods()

getName

public abstract java.lang.String getName()

getNestedType

public abstract JClassType getNestedType(java.lang.String typeName)
                                  throws NotFoundException
Throws:
NotFoundException

getNestedTypes

public abstract JClassType[] getNestedTypes()

getOracle

public abstract TypeOracle getOracle()

getOverloads

public abstract JMethod[] getOverloads(java.lang.String name)

getOverridableMethods

public abstract 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.

Returns:
an array of JMethod objects representing overridable methods

getPackage

public abstract JPackage getPackage()

getSubtypes

public abstract JClassType[] getSubtypes()

getSuperclass

public abstract JClassType getSuperclass()

isAbstract

public abstract boolean isAbstract()

isAnnotationPresent

public abstract boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Description copied from interface: HasAnnotations
Returns true if this item has an annotation of the specified type.

Specified by:
isAnnotationPresent in interface HasAnnotations
Returns:
true if this item has an annotation of the specified type

isAssignableFrom

public boolean isAssignableFrom(JClassType possibleSubtype)
Returns true if this JClassType is assignable from the specified JClassType parameter.

Parameters:
possibleSubtype - possible subtype of this JClassType
Returns:
true if this JClassType is assignable from the specified JClassType parameter
Throws:
java.lang.NullPointerException - if possibleSubtype is null

isAssignableTo

public boolean isAssignableTo(JClassType possibleSupertype)
Returns true if this JClassType is assignable to the specified JClassType parameter.

Parameters:
possibleSupertype - possible supertype of this JClassType
Returns:
true if this JClassType is assignable to the specified JClassType parameter
Throws:
java.lang.NullPointerException - if possibleSupertype is null

isDefaultInstantiable

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

Returns:
true if the type is default instantiable, or false otherwise

isEnhanced

public final boolean isEnhanced()
Returns true if the type may be enhanced on the server to contain extra fields that are unknown to client code.

Returns:
true if the type might be enhanced on the server

isFinal

public abstract boolean isFinal()

isGenericType

public abstract JGenericType isGenericType()
Specified by:
isGenericType in class JType

isInterface

public abstract JClassType isInterface()
Specified by:
isInterface in class JType

isLocalType

@Deprecated
public final boolean isLocalType()
Deprecated. local types are not modeled


isMemberType

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

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

isPrivate

public abstract boolean isPrivate()

isProtected

public abstract boolean isProtected()

isPublic

public abstract boolean isPublic()

isStatic

public abstract boolean isStatic()

setEnhanced

public void setEnhanced()
Indicates that the type may be enhanced on the server to contain extra fields that are unknown to client code. TODO(rice): find a better way to do this.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

acceptSubtype

protected abstract void acceptSubtype(JClassType me)

getInheritableMethodsOnSuperclassesAndThisClass

protected abstract void getInheritableMethodsOnSuperclassesAndThisClass(java.util.Map<java.lang.String,JMethod> methodsBySignature)

getInheritableMethodsOnSuperinterfacesAndMaybeThisInterface

protected abstract void getInheritableMethodsOnSuperinterfacesAndMaybeThisInterface(java.util.Map<java.lang.String,JMethod> methodsBySignature)
Gets the methods declared in interfaces that this type extends. If this type is a class, its own methods are not added. If this type is an interface, its own methods are added. Used internally by getOverridableMethods().

Parameters:
methodsBySignature -

getModifierBits

protected abstract int getModifierBits()

isMaybeParameterizedType

protected com.google.gwt.core.ext.typeinfo.JMaybeParameterizedType isMaybeParameterizedType()

notifySuperTypesOf

protected abstract void notifySuperTypesOf(JClassType me)
Tells this type's superclasses and superinterfaces about it.


removeSubtype

protected abstract void removeSubtype(JClassType me)

GWT 2.1.1