public interface JClassType extends JType, HasAnnotations, HasMetaData
Modifier and Type | Method and Description |
---|---|
JParameterizedType |
asParameterizationOf(JGenericType type) |
<T extends Annotation> |
findAnnotationInTypeHierarchy(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(String name) |
JMethod |
findMethod(String name,
JType[] paramTypes) |
JClassType |
findNestedType(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(String name) |
JField[] |
getFields() |
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(String name,
JType[] paramTypes) |
JMethod[] |
getMethods()
Returns the declared methods of this class (not any superclasses or
superinterfaces).
|
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(String typeName) |
JClassType[] |
getNestedTypes() |
TypeOracle |
getOracle() |
JMethod[] |
getOverloads(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 |
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.
|
getJNISignature, getLeafType, getParameterizedQualifiedSourceName, getQualifiedBinaryName, getQualifiedSourceName, getSimpleSourceName, isAnnotation, isArray, isClass, isClassOrInterface, isEnum, isGenericType, isInterface, isParameterized, isPrimitive, isRawType, isTypeParameter, isWildcard
getAnnotation, getAnnotations, getDeclaredAnnotations, isAnnotationPresent
getMetaData, getMetaDataTags
JParameterizedType asParameterizationOf(JGenericType type)
<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.
annotationType
- the type of the annotation to look fornull
if the annotation is
not present in the type's type hierarchyJConstructor findConstructor(JType[] paramTypes)
JClassType findNestedType(String typeName)
JConstructor getConstructor(JType[] paramTypes) throws NotFoundException
NotFoundException
JConstructor[] getConstructors()
JClassType getEnclosingType()
JClassType getErasedType()
JType
getErasedType
in interface JType
JField[] getFields()
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(String name, JType[] paramTypes) throws NotFoundException
NotFoundException
JMethod[] getMethods()
String getName()
JClassType getNestedType(String typeName) throws NotFoundException
NotFoundException
JClassType[] getNestedTypes()
TypeOracle getOracle()
JMethod[] getOverloads(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 JClassType
true
if this JClassType
is assignable from the
specified JClassType
parameterNullPointerException
- if possibleSubtype
is
null
boolean isAssignableTo(JClassType possibleSupertype)
possibleSupertype
- possible supertype of this JClassType
true
if this JClassType
is assignable to the
specified JClassType
parameterNullPointerException
- if possibleSupertype
is
null
boolean 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()
@Deprecated boolean isLocalType()
boolean isMemberType()
boolean isPrivate()
boolean isProtected()
boolean isPublic()
boolean isPackageProtected()
boolean isStatic()
void setEnhanced()
Copyright © 2018. All rights reserved.