public class QuickJavaClass extends java.lang.Object implements JavaClass
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<JavaType> |
interfaces |
protected JavaType |
superClass |
EMPTY_ARRAY| Constructor and Description |
|---|
QuickJavaClass(JavaType superClass,
java.util.List<JavaType> interfaces) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCompiledInfo()
Clears all cached compiled information.
|
boolean |
equals(java.lang.Object o) |
java.util.Collection<JavaType> |
getActualTypeArguments()
Get the type arguments, if any.
|
JavaAnnotation |
getAnnotation(JavaType annotationType)
Retrieves the annotation declared on this element that matches
the input annotation type.
|
java.util.Collection<JavaAnnotation> |
getAnnotations()
Retrieves all the annotations declared on this element.
|
int |
getArrayDimensions() |
JavaType |
getBaseComponentType() |
JavaClass |
getClass(java.lang.String name)
Iteratively retrieves all member classes declared in this class
or its hierarchy.
|
java.util.Collection<JavaClass> |
getClasses()
Iteratively retrieves all member classes declared in this class
or its hierarchy.
|
JavaMethod |
getClinitMethod() |
JavaClass |
getClosestClass()
Synonymous with
JavaType.getTypeErasure() . |
JavaType |
getComponentType() |
JavaAnnotation |
getDeclaredAnnotation(JavaType annotationType) |
java.util.Collection<JavaAnnotation> |
getDeclaredAnnotations()
Retrieves all the annotations declared on this element.
|
java.util.Collection<JavaClass> |
getDeclaredAnonymousClasses()
Get the anonymous classes in this type.
|
JavaClass |
getDeclaredClass(java.lang.String name)
Get the direct member class that has the incoming name.
|
java.util.Collection<JavaClass> |
getDeclaredClasses()
Get the direct member classes of this type.
|
JavaMethod |
getDeclaredConstructor(JavaType[] parameters)
Get the declared constructor, which might be synthetic,
with the given parameter types.
|
java.util.Collection<JavaMethod> |
getDeclaredConstructors()
Get the collection of declared constructors, some of which might
be synthetic.
|
JavaField |
getDeclaredField(java.lang.String name) |
java.util.Collection<JavaField> |
getDeclaredFields() |
java.util.Collection<JavaClass> |
getDeclaredLocalClasses()
Get the local classes in this type.
|
JavaMethod |
getDeclaredMethod(java.lang.String name,
JavaType[] parameters)
Get the declared non-constructor method, which might be
synthetic, with the given name and parameter types.
|
java.util.Collection<JavaMethod> |
getDeclaredMethods()
Get the collection of declared non-constructor methods, some
of which might be synthetic.
|
java.util.Collection<JavaMethod> |
getDeclaredMethods(java.lang.String name)
Get the collection of declared non-constructor methods, some
of which might be synthetic, with the given name.
|
java.lang.String |
getDescriptor()
Gets the descriptor for this type, as defined by the JVMS2.
|
int |
getElementKind() |
JavaField |
getField(java.lang.String name)
Iteratively searches for a field declared in this class or its
hierarchy.
|
java.util.Collection<JavaField> |
getFields()
Iteratively retrieves all fields declared in this class and its
hierarchy.
|
JavaFile |
getFile() |
java.util.Set<JavaType> |
getHierarchy()
Recursively gets the full list of all resolved superclasses and
super-interfaces.
|
java.util.Collection<JavaType> |
getInterfaces()
The name "getInterfaces" was chosen to be consistent with
java/lang/Class.
|
JavaMethod |
getMethod(java.lang.String name,
JavaType[] parameters)
Iteratively searches for a method declared in this class or its
hierarchy.
|
java.util.Collection<JavaMethod> |
getMethods()
Iteratively retrieves all methods declared in this class or its
hierarchy.
|
java.util.Collection<JavaMethod> |
getMethods(java.lang.String name)
Iteratively retrieves all methods declared in this class or its
hierarchy.
|
int |
getModifiers() |
java.lang.String |
getName()
Gets the simplest name of this type with "[]"s if present.
|
JavaType |
getNonParameterizedType()
Get the JavaType as it was declared.
|
JavaElement |
getOwner()
Finds the owner of this JavaElement, which is the closest named
ancestor found, such as a JavaClass, JavaMethod, JavaField, etc.
|
JavaClass |
getOwningClass()
Get the owning class, which is the class that declares this member.
|
JavaPackage |
getPackage()
Gets the owning package, null if N/A.
|
java.lang.String |
getPackageName()
Gets the qualified name of the owning package.
|
JavaProvider |
getProvider()
Get a JavaProvider which can be used to resolve types.
|
java.lang.String |
getQualifiedName()
Gets the fully qualified name of this type in source format.
|
JavaType |
getQualifyingType()
Get the qualifying type of this JavaType if there is one.
|
java.lang.String |
getRawName()
Gets the raw name of this type.
|
JavaType |
getResolvedType()
A JavaField instance will return the field's type.
|
java.lang.String |
getSignature()
Gets the "Signature" attribute of this type, as defined by the
JVMS3.
|
SourceClass |
getSourceElement() |
JavaType |
getSuperclass()
The name "getSuperclass" was chosen to be consistent with
java/lang/Class.
|
CompiledTmpVariable |
getThisValue()
In the interest of minimizing the number of tmp variables
floating around in the heap, each type may create a value object
(when needed) and store it (with a weak reference) for later use.
|
java.util.Collection<JavaAnnotation> |
getTypeAnnotations()
Applies to elements that are used as a type reference which
since JDK8 can be annotated.
|
JavaClass |
getTypeErasure()
Gets the type erasure of this type, as defined by the JLS3.
|
JavaTypeVariable |
getTypeParameter(java.lang.String name) |
java.util.Collection<JavaTypeVariable> |
getTypeParameters() |
java.lang.String |
getTypeSignature()
Gets the type signature for this type, as defined by the
JVMS3.
|
java.lang.String |
getUniqueIdentifier()
Gets a unique identifier for this type.
|
java.lang.String |
getUnqualifiedName()
Gets the name of this type in its unqualified form.
|
java.util.Collection<UnresolvedType> |
getUnresolvedInterfaces()
When reverse engineering bytecode, some types cannot be resolved
if the correct owning project is not associated to the JavaProvider.
|
UnresolvedType |
getUnresolvedSuperclass()
When reverse engineering bytecode, some types cannot be resolved
if the correct owning project is not associated to the JavaProvider.
|
UnresolvedType |
getUnresolvedType()
Information about a type that has not been resolved.
|
java.net.URL |
getURL()
If the input for this type is a *.class file, the returned URL
will be for the *.class file.
|
java.lang.String |
getVMName()
Gets the VM name for this type.
|
boolean |
hasActualTypeArguments()
Determine if this type or member has explicit or implicit
(in the case of the diamond syntax) type arguments, e.g.
|
int |
hashCode() |
boolean |
hasTypeParameters() |
boolean |
isAbstract() |
boolean |
isAnnotation() |
boolean |
isAnonymousClass()
Determine if this is an anonymous class type.
|
boolean |
isArray() |
boolean |
isAssignableFrom(JavaType subject)
Determine if the incoming subject can be assigned to this JavaType.
|
boolean |
isDeprecated() |
boolean |
isEnum() |
boolean |
isErasedType()
Is this a class with type parameters instantiated without any type arguments?
For instance, the type of 'new ArrayList()' would be an erased type.
|
boolean |
isExported() |
boolean |
isFinal() |
boolean |
isHidden() |
boolean |
isInterface() |
boolean |
isLocalClass()
Determine if this is a local (to a method) class type.
|
boolean |
isMemberClass()
Determine if this is a member class type.
|
boolean |
isPackagePrivate() |
boolean |
isPrimitive()
Determine if this type is a primitive type.
|
boolean |
isPrivate() |
boolean |
isProtected() |
boolean |
isPublic() |
boolean |
isSourceElement()
Determine if this IS a SourceElement in which case this JavaElement
can be cast to a SourceElement.
|
boolean |
isStatic() |
boolean |
isSubtypeOf(JavaType supertype)
True if this is a subtype of the indicated argument.
|
boolean |
isSynthetic() |
java.lang.String |
printCompiledInfo()
Debugging function for printing out compiled information.
|
void |
setQualifyingType(JavaType qualifyingType)
Set the qualifying type of this JavaType.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetAnonymousClassSuperTypehasAnnotation, hasDeclaredAnnotationisMandatedprotected JavaType superClass
protected java.util.List<JavaType> interfaces
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic void clearCompiledInfo()
JavaClassclearCompiledInfo in interface JavaClasspublic JavaClass getClosestClass()
JavaTypeJavaType.getTypeErasure() . If this type is a ...
... JavaClass, then it is returned.
... JavaTypeVariable, then the first bound is returned. There is always at least one bound.
... JavaWildcardType, then the lower bound is returned. There is always at least one lower bound.
.
getClosestClass in interface JavaTypepublic CompiledTmpVariable getThisValue()
JavaTypeEXPERIMENTAL.
getThisValue in interface JavaTypepublic boolean isPrimitive()
JavaTypeisPrimitive in interface JavaTypepublic boolean isArray()
public JavaType getComponentType()
getComponentType in interface JavaTypepublic int getArrayDimensions()
getArrayDimensions in interface JavaTypepublic JavaType getBaseComponentType()
getBaseComponentType in interface JavaTypepublic boolean isInterface()
isInterface in interface JavaTypepublic boolean isEnum()
public boolean isAnnotation()
isAnnotation in interface JavaTypepublic boolean isExported()
isExported in interface JavaTypepublic boolean isMemberClass()
JavaTypeisMemberClass in interface JavaTypepublic boolean isAnonymousClass()
JavaTypeisAnonymousClass in interface JavaTypepublic boolean isLocalClass()
JavaTypeisLocalClass in interface JavaTypepublic java.lang.String getName()
JavaTypeThe name of a non-parameterized top-level type of the form "pkg.Cls" is "Cls".
The name of a non-parameterized member type of the form "pkg.Cls.InnerClass" is "InnerClass".
The name of an array type T[] is the name of T suffixed by the appropriate number of "[]"s.
The name of a parameterized type is the same as the name of its raw type. That is, the name of "pkg.Cls<String>" is simply "Cls".
The name of a wildcard type is always "?".
The name of a type parameter type is the type parameter name.
The name of a primitive type is the primitive type name.
The name of a local inner class type is just its name.
The name of an anonymous class type is the empty String.
getName in interface JavaHasNamegetName in interface JavaTypepublic java.lang.String getUnqualifiedName()
JavaTypeUnlike getName(), this will contain type parameters in their unqualified form. In other words, for types containing no type parameterization, the behavior is the same as getName().
getUnqualifiedName in interface JavaTypepublic java.lang.String getQualifiedName()
JavaTypeThe source name of a non-parameterized top-level type of the form "pkg.Cls" is "pkg.Cls".
The source name of a non-parameterized member type of the form T.InnerClass (that is, a member type InnerClass that is a member of type T) is the source name of T suffixed with by ".InnerClass", e.g. "java.util.Map.Entry", "pkg.Cls<?>.InnerClass".
The source name of a parameterized type starts with the source name of the raw type and lists the source name of all of its actual type argumenths, e.g. "java.util.List<java.lang.String>". The source name of an array type T[] is the source name of T suffixed by the appropriate number of "[]"s.
The source name of a wildcard type is the string with which it would appear in a source file. The three possible forms this can take are: "?", "? extends T", "? super T".
The source name of a type parameter type is just its name.
The source name of a primitive type is the primitive type name.
The source name of a local inner class type is just its name because a local inner class is referenced, in a source file, by its name.
The name of an anonymous class type is the empty String.
getQualifiedName in interface JavaTypejava.lang.Object
java.util.Map<String,String>
java.lang.String[][]public java.lang.String getRawName()
JavaTypeThe raw name of a parameterized top-level or member or local inner type is the source name of its type erasure, as defined by the JLS3. Think of the raw name as the source name with all parameterization stripped out.
The raw name of an array type T[] is the raw name of T suffixed by the appropriate number of "[]"s.
The raw name for any other type is the same as its source name.
getRawName in interface JavaTypepublic java.lang.String getVMName()
JavaTypeThe VM name of a non-parameterized top-level type of the form "pkg.Cls" is "pkg/Cls".
The VM name of a non-parameterized member-level type of the form "pkg.Cls.InnerClass" is "pkg/Cls$InnerClass".
The VM name of a parameterized type is the VM name of the raw type. Because parameterization is stripped at run-time, we will omit it from the VM name.
The VM name of an array type T[] is the VM name of T suffixed by the appropriate number of "[]"s.
The VM name of a local inner class or anonymous inner class is a string that uniquely identifies it from all other types and is usually prefixed with the VM name of its directly enclosing class. For example, the VM name for an anonymous inner class belonging to the type "pkg.Cls" may be "pkg/Cls$1" and the VM name for a local class of that type may be "pkg/Cls$1foo.
The VM name of any other type is the same as its source name.
public JavaClass getTypeErasure()
JavaTypegetTypeErasure in interface JavaTypepublic java.lang.String getDescriptor()
JavaTypeFor jdk < 1.5, the "FieldDescriptor" is returned (JVMS2). For jdk < 1.5, descriptors and signatures are the same thing.
For jdk >= 1.5, a type signature of the type erasure is returned using '$' as the class separator.
Note: Do not confuse a type's descriptor with a method's descriptor. The descriptor of the type of a method is the field descriptor describing its return type. The descriptor of a method describes parameter types.
getDescriptor in interface JavaTypepublic java.lang.String getTypeSignature()
JavaType
A JavaClass returns its "ClassTypeSignature" (JVMS3). A JavaClass
is uniquely identified by its type signature. Example value:
Ljava/util/List<Ljava/lang/Object;>;
A JavaTypeVariable returns its "TypeVariableSignature" (JVMS3). A
type variable is uniquely identified by the combination of its
owning declaration AND its type signature. Example value:
TE;
A WildcardType returns its "TypeArgument" value (JVMS3). A
wildcard type is uniquely identified by its type
signature. Example values: *
+Ljava/lang/Object;.
Inner class are separated from their outer class by '.', e.g. Ljava/util/AbstractList<TE;>.Itr;Ljava/util/ListIterator<TE;>;
getTypeSignature in interface JavaTypepublic java.lang.String getSignature()
JavaTypeThe "Signature" attribute for a field is the "ClassTypeSignature" for its type.
The "Signature" attribute for a method involves the "ClassSignature"s for its type parameters and the "ClassTypeSignature"s of its remaining constituent types.
A JavaClass returns its "ClassSignature" (JVMS3).
A JavaTypeVariable does not have a class signature, but will return a string for use in a class signature or a method signature.
A WildcardType does not have a class signature and may not part of a class signature. Its return value is undefined.
getSignature in interface JavaTypepublic java.lang.String getUniqueIdentifier()
JavaTypegetUniqueIdentifier in interface JavaMembergetUniqueIdentifier in interface JavaTypepublic JavaPackage getPackage()
JavaTypegetPackage in interface JavaTypepublic java.lang.String getPackageName()
JavaTypegetPackageName in interface JavaTypepublic JavaType getSuperclass()
JavaTypegetSuperclass in interface JavaTypepublic UnresolvedType getUnresolvedSuperclass()
JavaTypegetUnresolvedSuperclass in interface JavaTypepublic java.util.Collection<JavaType> getInterfaces()
JavaTypegetInterfaces in interface JavaTypepublic java.util.Collection<UnresolvedType> getUnresolvedInterfaces()
JavaTypegetUnresolvedInterfaces in interface JavaTypepublic java.util.Set<JavaType> getHierarchy()
JavaTypegetHierarchy in interface JavaTypepublic boolean isAssignableFrom(JavaType subject)
JavaTypeisAssignableFrom in interface JavaTypeConversions.applyAssignmentConversion(oracle.javatools.parser.java.v2.model.JavaType, oracle.javatools.parser.java.v2.model.JavaType, boolean, oracle.javatools.parser.java.v2.JavaProvider)public boolean isSubtypeOf(JavaType supertype)
JavaTypeisSubtypeOf in interface JavaTypepublic java.util.Collection<JavaField> getDeclaredFields()
getDeclaredFields in interface JavaTypepublic JavaField getDeclaredField(java.lang.String name)
getDeclaredField in interface JavaTypename - Require non-null.public java.util.Collection<JavaMethod> getDeclaredConstructors()
JavaTypegetDeclaredConstructors in interface JavaTypepublic JavaMethod getDeclaredConstructor(JavaType[] parameters)
JavaTypegetDeclaredConstructor in interface JavaTypeparameters - The parameter types, null indicates
an empty parameter list.public java.util.Collection<JavaMethod> getDeclaredMethods()
JavaTypegetDeclaredMethods in interface JavaTypepublic java.util.Collection<JavaMethod> getDeclaredMethods(java.lang.String name)
JavaTypegetDeclaredMethods in interface JavaTypename - A name which should not be nullpublic JavaMethod getDeclaredMethod(java.lang.String name, JavaType[] parameters)
JavaTypegetDeclaredMethod in interface JavaTypename - A name which should not be nullparameters - The parameter types, null indicates
an empty parameter list.public java.util.Collection<JavaClass> getDeclaredClasses()
JavaTypegetDeclaredClasses in interface JavaTypepublic JavaClass getDeclaredClass(java.lang.String name)
JavaTypegetDeclaredClass in interface JavaTypepublic java.util.Collection<JavaClass> getDeclaredAnonymousClasses()
JavaTypegetDeclaredAnonymousClasses in interface JavaTypepublic java.util.Collection<JavaClass> getDeclaredLocalClasses()
JavaTypegetDeclaredLocalClasses in interface JavaTypepublic JavaMethod getClinitMethod()
getClinitMethod in interface JavaTypepublic java.util.Collection<JavaField> getFields()
JavaTypeThe implicit length field for array types is not reflected by this method.
public JavaField getField(java.lang.String name)
JavaTypeThe implicit length field for array types is not reflected by this method.
public java.util.Collection<JavaMethod> getMethods()
JavaTypegetMethods in interface JavaTypepublic java.util.Collection<JavaMethod> getMethods(java.lang.String name)
JavaTypegetMethods in interface JavaTypename - Require non-null.public JavaMethod getMethod(java.lang.String name, JavaType[] parameters)
JavaTypepublic java.util.Collection<JavaClass> getClasses()
JavaTypegetClasses in interface JavaTypepublic JavaClass getClass(java.lang.String name)
JavaTypeNote: Be careful not to get this confused with JavaProvider.getClass( String ).
public java.net.URL getURL()
JavaTypepublic JavaClass getOwningClass()
JavaMembergetOwningClass in interface JavaMemberpublic boolean isPublic()
isPublic in interface JavaMemberpublic boolean isProtected()
isProtected in interface JavaMemberpublic boolean isPrivate()
isPrivate in interface JavaMemberpublic boolean isStatic()
isStatic in interface JavaMemberpublic boolean isAbstract()
isAbstract in interface JavaMemberpublic boolean isPackagePrivate()
isPackagePrivate in interface JavaMemberpublic int getElementKind()
getElementKind in interface JavaElementpublic JavaFile getFile()
getFile in interface JavaElementIf a SourceFile is returned, then this element is declared in or otherwise comes in a SourceFile.
A non-null JavaFile may be returned that is not a SourceFile. For example, a JavaClass that came from a .class file definition will return such a JavaFile instance.
If null, then this element was created on-the-fly.
public JavaElement getOwner()
JavaElementgetOwner in interface JavaElementpublic boolean isSourceElement()
JavaElementisSourceElement in interface JavaElementpublic SourceClass getSourceElement()
getSourceElement in interface JavaClassgetSourceElement in interface JavaElementpublic int getModifiers()
getModifiers in interface JavaElementpublic boolean isFinal()
isFinal in interface JavaElementpublic boolean isSynthetic()
isSynthetic in interface JavaElementpublic boolean isHidden()
isHidden in interface JavaElementpublic boolean isDeprecated()
isDeprecated in interface JavaElementpublic java.lang.String printCompiledInfo()
JavaElementprintCompiledInfo in interface JavaElementpublic JavaType getResolvedType()
JavaHasTypeA JavaMethod instance will return the method's return type.
A JavaVariable instance will return the variable's type.
A JavaType instance will return itself.
An array is a special case, you can't determine the type of an array by its members, e.g. with { 0, 'e', (short)5 } the type could be int[], char[], short[], long[], Object[] and more. So for arrays the Null type (returns 'null' for the name) will be returned with the appropriate dimensions, e.g.: { "bar", "foo" } will have null[] type, { null, { null, 5, 5L } } will have null[][] type.
getResolvedType in interface JavaHasTypepublic UnresolvedType getUnresolvedType()
JavaHasTypegetUnresolvedType in interface JavaHasTypepublic java.util.Collection<JavaAnnotation> getDeclaredAnnotations()
JavaHasAnnotationsgetDeclaredAnnotations in interface JavaHasAnnotationspublic java.util.Collection<JavaAnnotation> getAnnotations()
JavaHasAnnotationsgetAnnotations in interface JavaHasAnnotationspublic JavaAnnotation getDeclaredAnnotation(JavaType annotationType)
getDeclaredAnnotation in interface JavaHasAnnotationspublic JavaAnnotation getAnnotation(JavaType annotationType)
JavaHasAnnotationsgetAnnotation in interface JavaHasAnnotationspublic boolean hasTypeParameters()
hasTypeParameters in interface JavaIsGenericpublic java.util.Collection<JavaTypeVariable> getTypeParameters()
getTypeParameters in interface JavaIsGenericpublic JavaTypeVariable getTypeParameter(java.lang.String name)
getTypeParameter in interface JavaIsGenericpublic boolean hasActualTypeArguments()
JavaIsGenerichasActualTypeArguments in interface JavaIsGenericpublic java.util.Collection<JavaType> getActualTypeArguments()
JavaIsGenericgetActualTypeArguments in interface JavaIsGenericpublic java.util.Collection<JavaAnnotation> getTypeAnnotations()
JavaTypegetTypeAnnotations in interface JavaTypepublic boolean isErasedType()
JavaTypeisErasedType in interface JavaTypepublic JavaProvider getProvider()
JavaTypegetProvider in interface JavaTypepublic JavaType getQualifyingType()
JavaTypegetQualifyingType in interface JavaTypepublic void setQualifyingType(JavaType qualifyingType)
JavaTypesetQualifyingType in interface JavaTypequalifyingType - The qualifying typepublic JavaType getNonParameterizedType()
JavaTypegetNonParameterizedType in interface JavaType