GWT 2.7.0

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

All Superinterfaces:
HasAnnotations, HasMetaData, JType
All Known Subinterfaces:
JAnnotationType, JArrayType, JEnumType, JGenericType, JParameterizedType, JRawType, JRealClassType, JTypeParameter, JWildcardType

public interface JClassType
extends JType, HasAnnotations, HasMetaData

Type used to represent any non-primitive type.


Method Summary
 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.
 JConstructor findConstructor(JType[] paramTypes)
          Returns the constructor with parameters that have the given types, or null if not found.
 JField findField(java.lang.String name)
           
 JMethod findMethod(java.lang.String name, JType[] paramTypes)
           
 JClassType findNestedType(java.lang.String typeName)
           
 JConstructor getConstructor(JType[] paramTypes)
           
 JConstructor[] getConstructors()
           
 JClassType getEnclosingType()
          Returns the enclosing type, or null if none.
 JClassType getErasedType()
          Returns this type with no type parameters or type variables.
 JField getField(java.lang.String name)
           
 JField[] getFields()
           
 java.util.Set<? extends JClassType> getFlattenedSupertypeHierarchy()
          Returns all of the superclasses and superinterfaces for a given type including the type itself.
 JClassType[] getImplementedInterfaces()
           
 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.
 JMethod getMethod(java.lang.String name, JType[] paramTypes)
           
 JMethod[] getMethods()
          Returns the declared methods of this class (not any superclasses or superinterfaces).
 java.lang.String getName()
          If an array, returns the name of this class without the package name or enclosing class name, followed by multiple pairs of square brackets; if not, returns the nested name of this type (like Foo or Foo.Bar), without the package name.
 JClassType getNestedType(java.lang.String typeName)
           
 JClassType[] getNestedTypes()
           
 TypeOracle getOracle()
           
 JMethod[] getOverloads(java.lang.String name)
          Returns the declared methods of this class with the given name (doesn't include any superclasses or superinterfaces).
 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.
 JPackage getPackage()
           
 JClassType[] getSubtypes()
          Returns all subtypes of this type, recursively, not including this type.
 JClassType getSuperclass()
          Returns the superclass of this type, or null if none.
 boolean isAbstract()
           
 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.
 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.
 boolean isFinal()
           
 boolean isLocalType()
          Deprecated. local types are not modeled
 boolean isMemberType()
          Tests if this type is contained within another type.
 boolean isPackageProtected()
           
 boolean isPrivate()
           
 boolean isProtected()
           
 boolean isPublic()
           
 boolean isStatic()
           
 void setEnhanced()
          Indicates that the type may be enhanced on the server to contain extra fields that are unknown to client code.
 
Methods inherited from interface com.google.gwt.core.ext.typeinfo.JType
getJNISignature, getLeafType, getParameterizedQualifiedSourceName, getQualifiedBinaryName, getQualifiedSourceName, getSimpleSourceName, isAnnotation, isArray, isClass, isClassOrInterface, isEnum, isGenericType, isInterface, isParameterized, isPrimitive, isRawType, isTypeParameter, isWildcard
 
Methods inherited from interface com.google.gwt.core.ext.typeinfo.HasAnnotations
getAnnotation, getAnnotations, getDeclaredAnnotations, isAnnotationPresent
 
Methods inherited from interface com.google.gwt.core.ext.typeinfo.HasMetaData
getMetaData, getMetaDataTags
 

Method Detail

asParameterizationOf

JParameterizedType asParameterizationOf(JGenericType type)

findAnnotationInTypeHierarchy

<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

JConstructor findConstructor(JType[] paramTypes)
Returns the constructor with parameters that have the given types, or null if not found.


findField

JField findField(java.lang.String name)

findMethod

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

findNestedType

JClassType findNestedType(java.lang.String typeName)

getConstructor

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

getConstructors

JConstructor[] getConstructors()

getEnclosingType

JClassType getEnclosingType()
Returns the enclosing type, or null if none.


getErasedType

JClassType getErasedType()
Description copied from interface: JType
Returns this type with no type parameters or type variables. See the JLS Third Edition section on Type Erasure.

Specified by:
getErasedType in interface JType

getField

JField getField(java.lang.String name)

getFields

JField[] getFields()

getFlattenedSupertypeHierarchy

java.util.Set<? extends 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

JClassType[] getImplementedInterfaces()

getInheritableMethods

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

getMethod

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

getMethods

JMethod[] getMethods()
Returns the declared methods of this class (not any superclasses or superinterfaces).


getName

java.lang.String getName()
If an array, returns the name of this class without the package name or enclosing class name, followed by multiple pairs of square brackets; if not, returns the nested name of this type (like Foo or Foo.Bar), without the package name.


getNestedType

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

getNestedTypes

JClassType[] getNestedTypes()

getOracle

TypeOracle getOracle()

getOverloads

JMethod[] getOverloads(java.lang.String name)
Returns the declared methods of this class with the given name (doesn't include any superclasses or superinterfaces).


getOverridableMethods

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

JPackage getPackage()

getSubtypes

JClassType[] getSubtypes()
Returns all subtypes of this type, recursively, not including this type.


getSuperclass

JClassType getSuperclass()
Returns the superclass of this type, or null if none.


isAbstract

boolean isAbstract()

isAssignableFrom

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

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

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

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

boolean isFinal()

isLocalType

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


isMemberType

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

boolean isPrivate()

isProtected

boolean isProtected()

isPublic

boolean isPublic()

isPackageProtected

boolean isPackageProtected()

isStatic

boolean isStatic()

setEnhanced

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.


GWT 2.7.0