public interface JClassType extends JType, HasAnnotations
| Modifier and Type | Method and Description |
|---|---|
JParameterizedType |
asParameterizationOf(JGenericType type) |
<T extends java.lang.annotation.Annotation> |
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)
|
boolean |
isAssignableTo(JClassType possibleSupertype)
|
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 |
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.
|
getJNISignature, getLeafType, getParameterizedQualifiedSourceName, getQualifiedBinaryName, getQualifiedSourceName, getSimpleSourceName, isAnnotation, isArray, isClass, isClassOrInterface, isEnum, isGenericType, isInterface, isParameterized, isPrimitive, isRawType, isTypeParameter, isWildcardgetAnnotation, getAnnotations, getDeclaredAnnotations, isAnnotationPresentJParameterizedType asParameterizationOf(JGenericType type)
<T extends java.lang.annotation.Annotation> T findAnnotationInTypeHierarchy(java.lang.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.
annotationType - the type of the annotation to look fornull if the annotation is
not present in the type's type hierarchyJConstructor findConstructor(JType[] paramTypes)
JField findField(java.lang.String name)
JClassType findNestedType(java.lang.String typeName)
JConstructor getConstructor(JType[] paramTypes) throws NotFoundException
NotFoundExceptionJConstructor[] getConstructors()
JClassType getEnclosingType()
JClassType getErasedType()
JTypegetErasedType in interface JTypeJField getField(java.lang.String name)
JField[] getFields()
java.util.Set<? extends JClassType> getFlattenedSupertypeHierarchy()
JClassType[] getImplementedInterfaces()
JMethod[] getInheritableMethods()
public, protected, or
package protected.
This method offers a convenient way for Generators to find candidate
methods to call from a subclass.JMethod objects representing inheritable
methodsJMethod getMethod(java.lang.String name, JType[] paramTypes) throws NotFoundException
NotFoundExceptionJMethod[] getMethods()
java.lang.String getName()
JClassType getNestedType(java.lang.String typeName) throws NotFoundException
NotFoundExceptionJClassType[] getNestedTypes()
TypeOracle getOracle()
JMethod[] getOverloads(java.lang.String name)
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.JMethod objects representing overridable
methodsJPackage getPackage()
JClassType[] getSubtypes()
JClassType getSuperclass()
null if none.boolean isAbstract()
boolean isAssignableFrom(JClassType possibleSubtype)
possibleSubtype - possible subtype of this JClassTypetrue if this JClassType is assignable from the
specified JClassType parameterjava.lang.NullPointerException - if possibleSubtype is
nullboolean isAssignableTo(JClassType possibleSupertype)
possibleSupertype - possible supertype of this JClassTypetrue if this JClassType is assignable to the
specified JClassType parameterjava.lang.NullPointerException - if possibleSupertype is
nullboolean isDefaultInstantiable()
new
operation. Specifically, the class must
true if the type is default instantiable, or
false otherwiseboolean isEnhanced()
true if the type might be enhanced on the serverboolean isFinal()
boolean isMemberType()
boolean isPrivate()
boolean isProtected()
boolean isPublic()
boolean isPackageProtected()
boolean isStatic()
void setEnhanced()