public interface ResolvedReferenceTypeDeclaration extends ResolvedTypeDeclaration, ResolvedTypeParametrizable
| Modifier and Type | Field and Description |
|---|---|
static Function<ResolvedReferenceTypeDeclaration,List<ResolvedReferenceType>> |
breadthFirstFunc |
static Function<ResolvedReferenceTypeDeclaration,List<ResolvedReferenceType>> |
depthFirstFunc |
static String |
JAVA_LANG_ENUM |
static String |
JAVA_LANG_OBJECT |
| Modifier and Type | Method and Description |
|---|---|
default ResolvedReferenceTypeDeclaration |
asReferenceType() |
default boolean |
canBeAssignedTo(ResolvedReferenceTypeDeclaration other)
Can we assign instances of the type defined by this declaration to variables having the type defined
by the given type?
|
default Optional<ResolvedTypeParameterDeclaration> |
findTypeParameter(String name)
Find the closest TypeParameterDeclaration with the given name.
|
default List<ResolvedReferenceType> |
getAllAncestors()
The list of all the ancestors of the current declaration, direct and indirect.
|
default List<ResolvedReferenceType> |
getAllAncestors(Function<ResolvedReferenceTypeDeclaration,List<ResolvedReferenceType>> traverser)
The list of all the ancestors of the current declaration, direct and indirect.
|
List<ResolvedFieldDeclaration> |
getAllFields()
Return a list of all fields, either declared in this declaration or inherited.
|
Set<MethodUsage> |
getAllMethods()
Return a list of all the methods declared of this type declaration, either declared or inherited.
|
default List<ResolvedFieldDeclaration> |
getAllNonStaticFields()
Return a list of all the non static fields, either declared or inherited.
|
default List<ResolvedFieldDeclaration> |
getAllStaticFields()
Return a list of all the static fields, either declared or inherited.
|
default List<ResolvedReferenceType> |
getAncestors()
Resolves the types of all direct ancestors (i.e., the directly extended class and the directly implemented
interfaces) and returns the list of ancestors as a list of resolved reference types.
|
List<ResolvedReferenceType> |
getAncestors(boolean acceptIncompleteList)
Resolves the types of all direct ancestors (i.e., the directly extended class and the directly implemented
interfaces) and returns the list of ancestors as a list of resolved reference types.
|
List<ResolvedConstructorDeclaration> |
getConstructors() |
default Optional<ResolvedAnnotationDeclaration> |
getDeclaredAnnotation(String name)
Returns the resolved annotation corresponding to the specified name and declared in this type declaration.
|
default Set<ResolvedAnnotationDeclaration> |
getDeclaredAnnotations()
Return a collection of all annotations declared in this type declaration.
|
default List<ResolvedFieldDeclaration> |
getDeclaredFields()
Return a list of all the fields declared in this type.
|
Set<ResolvedMethodDeclaration> |
getDeclaredMethods()
Return a list of all the methods declared in this type declaration.
|
default ResolvedFieldDeclaration |
getField(String name)
Note that the type of the field should be expressed using the type variables of this particular type.
|
default ResolvedFieldDeclaration |
getVisibleField(String name)
Consider only field or inherited field which is not private.
|
default List<ResolvedFieldDeclaration> |
getVisibleFields()
Return a list of all fields declared and the inherited ones which are not private.
|
default boolean |
hasAnnotation(String qualifiedName)
Has the type at least one annotation declared or inherited having the specified qualified name?
|
boolean |
hasDirectlyAnnotation(String qualifiedName)
Has the type at least one annotation declared having the specified qualified name?
|
default boolean |
hasField(String name)
Has this type a field with the given name?
|
default boolean |
hasVisibleField(String name)
Either a declared field or inherited field which is not private.
|
boolean |
isAssignableBy(ResolvedReferenceTypeDeclaration other)
Can we assign instances of the given type to variables having the type defined
by this declaration?
|
boolean |
isAssignableBy(ResolvedType type)
Can we assign instances of the given type to variables having the type defined
by this declaration?
|
boolean |
isFunctionalInterface()
This means that the type has a functional method.
|
default boolean |
isInheritedAnnotation(String name)
Returns true if the specified annotation is inheritable.
|
default boolean |
isJavaLangEnum() |
default boolean |
isJavaLangObject()
We don't make this _ex_plicit in the data representation because that would affect codegen
and make everything generate like
<T extends Object> instead of <T> |
default boolean |
isReferenceType()
Is this the declaration of a reference type?
|
asAnnotation, asClass, asEnum, asInterface, asType, asTypeParameter, containerType, getClassName, getId, getInternalType, getPackageName, getQualifiedName, hasInternalType, internalTypes, isAnnotation, isAnonymousClass, isClass, isEnum, isInterface, isType, isTypeParameterasEnumConstant, asField, asMethod, asParameter, asPattern, getName, hasName, isEnumConstant, isField, isMethod, isParameter, isPattern, isVariabletoAst, toAstgetTypeParameters, isGenericstatic final String JAVA_LANG_ENUM
static final String JAVA_LANG_OBJECT
static final Function<ResolvedReferenceTypeDeclaration,List<ResolvedReferenceType>> depthFirstFunc
static final Function<ResolvedReferenceTypeDeclaration,List<ResolvedReferenceType>> breadthFirstFunc
default ResolvedReferenceTypeDeclaration asReferenceType()
asReferenceType in interface ResolvedTypeDeclarationdefault boolean isReferenceType()
ResolvedTypeDeclarationisReferenceType in interface ResolvedTypeDeclarationdefault List<ResolvedReferenceType> getAncestors()
In case any ancestor cannot be resolved, an UnsolvedSymbolException is thrown. In order to obtain a list
of only the resolvable direct ancestors, use getAncestors(boolean) and pass the value true.
Note that an ancestor can be parametrized types with values specified. For example:
class A implements Comparable<String> {}
In this case the ancestor is Comparable<String>
UnsolvedSymbolException - if some ancestor could not be resolved.List<ResolvedReferenceType> getAncestors(boolean acceptIncompleteList)
If acceptIncompleteList is false, then an UnsolvedSymbolException is thrown if any
ancestor cannot be resolved. Otherwise, a list of only the resolvable direct ancestors is returned.
acceptIncompleteList - When set to false, this method throws an UnsolvedSymbolException if
one or more ancestor could not be resolved. When set to true, this method
does not throw an UnsolvedSymbolException, but the list of returned ancestors
may be incomplete in case one or more ancestor could not be resolved.UnsolvedSymbolException - if some ancestor could not be resolved and acceptIncompleteList is set to
false.default List<ResolvedReferenceType> getAllAncestors()
default List<ResolvedReferenceType> getAllAncestors(Function<ResolvedReferenceTypeDeclaration,List<ResolvedReferenceType>> traverser)
default ResolvedFieldDeclaration getField(String name)
class Foo
class Bar extends Foo
When calling getField("field") on Foo I should get a FieldDeclaration with type E, while calling it on
Bar I should get a FieldDeclaration with type String.
default ResolvedFieldDeclaration getVisibleField(String name)
default boolean hasField(String name)
default boolean hasVisibleField(String name)
List<ResolvedFieldDeclaration> getAllFields()
default List<ResolvedFieldDeclaration> getVisibleFields()
default List<ResolvedFieldDeclaration> getAllNonStaticFields()
default List<ResolvedFieldDeclaration> getAllStaticFields()
default List<ResolvedFieldDeclaration> getDeclaredFields()
Set<ResolvedMethodDeclaration> getDeclaredMethods()
Set<MethodUsage> getAllMethods()
boolean isAssignableBy(ResolvedType type)
default boolean canBeAssignedTo(ResolvedReferenceTypeDeclaration other)
boolean isAssignableBy(ResolvedReferenceTypeDeclaration other)
boolean hasDirectlyAnnotation(String qualifiedName)
default boolean hasAnnotation(String qualifiedName)
default boolean isInheritedAnnotation(String name)
default Optional<ResolvedAnnotationDeclaration> getDeclaredAnnotation(String name)
default Set<ResolvedAnnotationDeclaration> getDeclaredAnnotations()
boolean isFunctionalInterface()
default Optional<ResolvedTypeParameterDeclaration> findTypeParameter(String name)
ResolvedTypeParametrizablefindTypeParameter in interface ResolvedTypeParametrizableList<ResolvedConstructorDeclaration> getConstructors()
default boolean isJavaLangObject()
<T extends Object> instead of <T>java.lang.ObjectResolvedReferenceType.isJavaLangObject(),
https://github.com/javaparser/javaparser/issues/2044default boolean isJavaLangEnum()
java.lang.EnumResolvedReferenceType.isJavaLangEnum()Copyright © 2007–2023. All rights reserved.