public abstract class JClassType extends Object implements JClassType
Constructor and Description |
---|
JClassType() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
acceptSubtype(JClassType me) |
JParameterizedType |
asParameterizationOf(JGenericType type) |
boolean |
equals(Object obj)
All types use identity for comparison.
|
<T extends Annotation> |
findAnnotationInTypeHierarchy(Class<T> annotationType)
Find an annotation on a type or on one of its superclasses or
superinterfaces.
|
abstract JConstructor |
findConstructor(JType[] paramTypes)
Returns the constructor with parameters that have the given types, or null if not found.
|
abstract JField |
findField(String name) |
abstract JMethod |
findMethod(String name,
JType[] paramTypes) |
abstract JClassType |
findNestedType(String typeName) |
abstract <T extends Annotation> |
getAnnotation(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 Annotation[] |
getAnnotations()
Returns all the annotations present on this element.
|
abstract JConstructor |
getConstructor(JType[] paramTypes) |
abstract JConstructor[] |
getConstructors() |
abstract Annotation[] |
getDeclaredAnnotations()
Returns the annotations declared directly on this element; does not include
any inherited annotations.
|
abstract JClassType |
getEnclosingType()
Returns the enclosing type, or null if none.
|
abstract JClassType |
getErasedType()
Returns this type with no type parameters or type variables.
|
abstract JField |
getField(String name) |
abstract JField[] |
getFields() |
Set<JClassType> |
getFlattenedSupertypeHierarchy()
Returns all of the superclasses and superinterfaces for a given type
including the type itself.
|
protected static 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(Map<String,JMethod> methodsBySignature) |
protected abstract void |
getInheritableMethodsOnSuperinterfacesAndMaybeThisInterface(Map<String,JMethod> methodsBySignature)
Gets the methods declared in interfaces that this type extends.
|
abstract String |
getJNISignature()
Returns the
"field descriptor" for a type as specified by the Java Virtual Machine Specification.
|
JType |
getLeafType()
For array types, recursively looks for the element type that is not an
array.
|
String[][] |
getMetaData(String tagName)
Deprecated.
|
String[] |
getMetaDataTags()
Deprecated.
|
abstract JMethod |
getMethod(String name,
JType[] paramTypes) |
abstract JMethod[] |
getMethods()
Returns the declared methods of this class (not any superclasses or
superinterfaces).
|
protected abstract int |
getModifierBits() |
abstract 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, without the package name.
|
abstract JClassType |
getNestedType(String typeName) |
abstract JClassType[] |
getNestedTypes() |
abstract TypeOracle |
getOracle() |
abstract JMethod[] |
getOverloads(String name)
Returns the declared methods of this class with the given name
(doesn't include any superclasses or superinterfaces).
|
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() |
String |
getParameterizedQualifiedSourceName()
Returns a type name as it would be specified in Java source, with the
package name included.
|
abstract String |
getQualifiedBinaryName()
TODO(scottb): remove if we can resolve param names differently.
|
abstract String |
getQualifiedSourceName()
Returns a type name as it would be specified in Java source, with the
package name included.
|
abstract String |
getSimpleSourceName()
Returns the name of this class without the package name or enclosing class name.
|
abstract JClassType[] |
getSubtypes()
Returns all subtypes for this type.
|
abstract JClassType |
getSuperclass()
Returns the superclass of this type, or
null if none. |
int |
hashCode()
All types use identity for comparison.
|
abstract boolean |
isAbstract() |
JAnnotationType |
isAnnotation()
Returns this instance if it is a annotation or
null if it is
not. |
abstract boolean |
isAnnotationPresent(Class<? extends Annotation> annotationClass)
Returns
true if this item has an annotation of the specified
type. |
abstract JArrayType |
isArray() |
boolean |
isAssignableFrom(JClassType possibleSubtype)
|
boolean |
isAssignableTo(JClassType possibleSupertype)
|
abstract JClassType |
isClass()
Returns this instance if the erased version of this type is a class (as opposed to a primitive,
array, or interface) or
null if it is not. |
JClassType |
isClassOrInterface()
Returns this instance if the erased version of this type is a class or interface (as opposed to
a primitive or array array) or
null if it is not. |
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 JEnumType |
isEnum()
Returns this instance if it is an enumeration or
null if it is
not. |
abstract boolean |
isFinal() |
abstract JGenericType |
isGenericType()
Returns this instance if it is a real class that has type parameters or
null
if it is not. |
abstract JClassType |
isInterface()
Returns this instance if it is an interface or
null if it is not. |
boolean |
isLocalType()
Deprecated.
local types are not modeled
|
protected com.google.gwt.dev.javac.typemodel.JMaybeParameterizedType |
isMaybeParameterizedType() |
abstract boolean |
isMemberType()
Tests if this type is contained within another type.
|
abstract JParameterizedType |
isParameterized()
Returns this instance as a
JParameterizedType if it is a parameterized type
or null if it is not. |
abstract JPrimitiveType |
isPrimitive() |
abstract boolean |
isPrivate() |
abstract boolean |
isProtected() |
abstract boolean |
isPublic() |
abstract JRawType |
isRawType()
Returns the raw type if this is a
JRawType , otherwise returns
null . |
abstract boolean |
isStatic() |
JTypeParameter |
isTypeParameter() |
abstract JWildcardType |
isWildcard() |
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.
|
String |
toString() |
protected static Set<JClassType> getFlattenedSuperTypeHierarchy(JClassType type)
public JParameterizedType asParameterizationOf(JGenericType type)
asParameterizationOf
in interface JClassType
public final boolean equals(Object obj)
public <T extends Annotation> T findAnnotationInTypeHierarchy(Class<T> annotationType)
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.
findAnnotationInTypeHierarchy
in interface JClassType
annotationType
- the type of the annotation to look fornull
if the annotation is
not present in the type's type hierarchypublic abstract JConstructor findConstructor(JType[] paramTypes)
JClassType
findConstructor
in interface JClassType
public abstract JField findField(String name)
findField
in interface JClassType
public abstract JMethod findMethod(String name, JType[] paramTypes)
findMethod
in interface JClassType
public abstract JClassType findNestedType(String typeName)
findNestedType
in interface JClassType
public abstract <T extends Annotation> T getAnnotation(Class<T> annotationClass)
HasAnnotations
null
if it is not. For a class, this will
look for annotations on supertypes as well.getAnnotation
in interface HasAnnotations
annotationClass
- annotation type to search fornull
if it is notpublic abstract Annotation[] getAnnotations()
HasAnnotations
getAnnotations
in interface HasAnnotations
public abstract JConstructor getConstructor(JType[] paramTypes) throws NotFoundException
getConstructor
in interface JClassType
NotFoundException
public abstract JConstructor[] getConstructors()
getConstructors
in interface JClassType
public abstract Annotation[] getDeclaredAnnotations()
HasAnnotations
getDeclaredAnnotations
in interface HasAnnotations
public abstract JClassType getEnclosingType()
JClassType
getEnclosingType
in interface JClassType
public abstract JClassType getErasedType()
JType
getErasedType
in interface JClassType
getErasedType
in interface JType
public abstract JField getField(String name)
getField
in interface JClassType
public abstract JField[] getFields()
getFields
in interface JClassType
public Set<JClassType> getFlattenedSupertypeHierarchy()
getFlattenedSupertypeHierarchy
in interface JClassType
public abstract JClassType[] getImplementedInterfaces()
getImplementedInterfaces
in interface JClassType
public abstract JMethod[] getInheritableMethods()
public
, protected
, or
package protected.
This method offers a convenient way for Generators to find candidate
methods to call from a subclass.getInheritableMethods
in interface JClassType
JMethod
objects representing inheritable
methodspublic abstract String getJNISignature()
JType
Z
[B
Ljava/lang/String;
getJNISignature
in interface JType
public JType getLeafType()
JType
getLeafType
in interface JType
@Deprecated public final String[][] getMetaData(String tagName)
HasMetaData
getMetaData
in interface HasMetaData
@Deprecated public final String[] getMetaDataTags()
HasMetaData
getMetaDataTags
in interface HasMetaData
public abstract JMethod getMethod(String name, JType[] paramTypes) throws NotFoundException
getMethod
in interface JClassType
NotFoundException
public abstract JMethod[] getMethods()
JClassType
getMethods
in interface JClassType
public abstract String getName()
JClassType
getName
in interface JClassType
public abstract JClassType getNestedType(String typeName) throws NotFoundException
getNestedType
in interface JClassType
NotFoundException
public abstract JClassType[] getNestedTypes()
getNestedTypes
in interface JClassType
public abstract TypeOracle getOracle()
getOracle
in interface JClassType
public abstract JMethod[] getOverloads(String name)
JClassType
getOverloads
in interface JClassType
public abstract JMethod[] getOverridableMethods()
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.getOverridableMethods
in interface JClassType
JMethod
objects representing overridable
methodspublic abstract JPackage getPackage()
getPackage
in interface JClassType
public String getParameterizedQualifiedSourceName()
JType
getParameterizedQualifiedSourceName
in interface JType
public abstract String getQualifiedBinaryName()
getQualifiedBinaryName
in interface JType
public abstract String getQualifiedSourceName()
JType
getQualifiedSourceName
in interface JType
public abstract String getSimpleSourceName()
JType
getSimpleSourceName
in interface JType
public abstract JClassType[] getSubtypes()
getBaseType()
.Object
.getSubtypes
in interface JClassType
public abstract JClassType getSuperclass()
JClassType
null
if none.getSuperclass
in interface JClassType
public final int hashCode()
public abstract boolean isAbstract()
isAbstract
in interface JClassType
public JAnnotationType isAnnotation()
null
if it is
not.isAnnotation
in interface JType
null
if it is
notpublic abstract boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
HasAnnotations
true
if this item has an annotation of the specified
type. For a class, this will look at supertypes as well.isAnnotationPresent
in interface HasAnnotations
true
if this item has an annotation of the specified
typepublic abstract JArrayType isArray()
public boolean isAssignableFrom(JClassType possibleSubtype)
isAssignableFrom
in interface JClassType
possibleSubtype
- possible subtype of this JClassType
true
if this JClassType
is assignable from the
specified JClassType
parameterNullPointerException
- if possibleSubtype
is
null
public boolean isAssignableTo(JClassType possibleSupertype)
isAssignableTo
in interface JClassType
possibleSupertype
- possible supertype of this JClassType
true
if this JClassType
is assignable to the
specified JClassType
parameterNullPointerException
- if possibleSupertype
is
null
public abstract JClassType isClass()
JType
null
if it is not.public JClassType isClassOrInterface()
JType
null
if it is not.isClassOrInterface
in interface JType
public abstract boolean isDefaultInstantiable()
new
operation. Specifically, the class must
isDefaultInstantiable
in interface JClassType
true
if the type is default instantiable, or
false
otherwisepublic final boolean isEnhanced()
isEnhanced
in interface JClassType
true
if the type might be enhanced on the serverpublic abstract JEnumType isEnum()
null
if it is
not.public abstract boolean isFinal()
isFinal
in interface JClassType
public abstract JGenericType isGenericType()
JType
null
if it is not.isGenericType
in interface JType
public abstract JClassType isInterface()
JType
null
if it is not.isInterface
in interface JType
@Deprecated public final boolean isLocalType()
isLocalType
in interface JClassType
public abstract boolean isMemberType()
isMemberType
in interface JClassType
public abstract JParameterizedType isParameterized()
JType
JParameterizedType
if it is a parameterized type
or null
if it is not.isParameterized
in interface JType
public abstract JPrimitiveType isPrimitive()
isPrimitive
in interface JType
public abstract boolean isPrivate()
isPrivate
in interface JClassType
public abstract boolean isProtected()
isProtected
in interface JClassType
public abstract boolean isPublic()
isPublic
in interface JClassType
public abstract JRawType isRawType()
JType
JRawType
, otherwise returns
null
.public abstract boolean isStatic()
isStatic
in interface JClassType
public JTypeParameter isTypeParameter()
isTypeParameter
in interface JType
public abstract JWildcardType isWildcard()
isWildcard
in interface JType
public void setEnhanced()
setEnhanced
in interface JClassType
protected abstract void acceptSubtype(JClassType me)
protected abstract void getInheritableMethodsOnSuperclassesAndThisClass(Map<String,JMethod> methodsBySignature)
protected abstract void getInheritableMethodsOnSuperinterfacesAndMaybeThisInterface(Map<String,JMethod> methodsBySignature)
getOverridableMethods()
.methodsBySignature
- protected abstract int getModifierBits()
protected com.google.gwt.dev.javac.typemodel.JMaybeParameterizedType isMaybeParameterizedType()
protected abstract void notifySuperTypesOf(JClassType me)
protected abstract void removeSubtype(JClassType me)
Copyright © 2018. All rights reserved.