Interface ResolvedReferenceTypeDeclaration

    • Field Detail

      • JAVA_LANG_ENUM

        static final java.lang.String JAVA_LANG_ENUM
      • JAVA_LANG_COMPARABLE

        static final java.lang.String JAVA_LANG_COMPARABLE
      • JAVA_IO_SERIALIZABLE

        static final java.lang.String JAVA_IO_SERIALIZABLE
      • JAVA_LANG_OBJECT

        static final java.lang.String JAVA_LANG_OBJECT
    • Method Detail

      • getAncestors

        default java.util.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.

        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>

        Returns:
        The list of resolved ancestors.
        Throws:
        UnsolvedSymbolException - if some ancestor could not be resolved.
      • getAncestors

        java.util.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.

        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.

        Parameters:
        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.
        Returns:
        The list of resolved ancestors.
        Throws:
        UnsolvedSymbolException - if some ancestor could not be resolved and acceptIncompleteList is set to false.
      • getAllAncestors

        default java.util.List<ResolvedReferenceType> getAllAncestors()
        The list of all the ancestors of the current declaration, direct and indirect. This list does not contains duplicates with the exact same type parameters. For example if A inherits from B, and B inherits from C and implements D, and C inherits from E By default the traversal is depth first
      • getAllAncestors

        default java.util.List<ResolvedReferenceType> getAllAncestors​(java.util.function.Function<ResolvedReferenceTypeDeclaration,​java.util.List<ResolvedReferenceType>> traverser)
        The list of all the ancestors of the current declaration, direct and indirect. This list does not contains duplicates with the exact same type parameters. For example if A inherits from B, and B inherits from C and implements D, and C inherits from E Apply the specified traversal
      • getField

        default ResolvedFieldDeclaration getField​(java.lang.String name)
        Note that the type of the field should be expressed using the type variables of this particular type. Consider for example:

        class Foo { E field; }

        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.

      • getVisibleField

        default ResolvedFieldDeclaration getVisibleField​(java.lang.String name)
        Consider only field or inherited field which is not private.
      • hasField

        default boolean hasField​(java.lang.String name)
        Has this type a field with the given name?
      • hasVisibleField

        default boolean hasVisibleField​(java.lang.String name)
        Either a declared field or inherited field which is not private.
      • getAllFields

        java.util.List<ResolvedFieldDeclaration> getAllFields()
        Return a list of all fields, either declared in this declaration or inherited.
      • getVisibleFields

        default java.util.List<ResolvedFieldDeclaration> getVisibleFields()
        Return a list of all fields declared and the inherited ones which are not private.
      • getAllNonStaticFields

        default java.util.List<ResolvedFieldDeclaration> getAllNonStaticFields()
        Return a list of all the non static fields, either declared or inherited.
      • getAllStaticFields

        default java.util.List<ResolvedFieldDeclaration> getAllStaticFields()
        Return a list of all the static fields, either declared or inherited.
      • getDeclaredFields

        default java.util.List<ResolvedFieldDeclaration> getDeclaredFields()
        Return a list of all the fields declared in this type.
      • getDeclaredMethods

        java.util.Set<ResolvedMethodDeclaration> getDeclaredMethods()
        Return a list of all the methods declared in this type declaration.
      • getAllMethods

        java.util.Set<MethodUsage> getAllMethods()
        Return a list of all the methods declared of this type declaration, either declared or inherited. Note that it should not include overridden methods.
      • isAssignableBy

        boolean isAssignableBy​(ResolvedType type)
        Can we assign instances of the given type to variables having the type defined by this declaration?
      • canBeAssignedTo

        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?
      • isAssignableBy

        boolean isAssignableBy​(ResolvedReferenceTypeDeclaration other)
        Can we assign instances of the given type to variables having the type defined by this declaration?
      • hasDirectlyAnnotation

        boolean hasDirectlyAnnotation​(java.lang.String qualifiedName)
        Has the type at least one annotation declared having the specified qualified name?
      • hasAnnotation

        default boolean hasAnnotation​(java.lang.String qualifiedName)
        Has the type at least one annotation declared or inherited having the specified qualified name? By default, the subclasses do not inherit the annotation declared on the parent class. However, there is a way to propagate particular annotations throughout the class hierarchy using the @Inherited annotation.
      • isInheritedAnnotation

        default boolean isInheritedAnnotation​(java.lang.String name)
        Returns true if the specified annotation is inheritable.
      • getDeclaredAnnotation

        default java.util.Optional<ResolvedAnnotationDeclaration> getDeclaredAnnotation​(java.lang.String name)
        Returns the resolved annotation corresponding to the specified name and declared in this type declaration.
      • getDeclaredAnnotations

        default java.util.Set<ResolvedAnnotationDeclaration> getDeclaredAnnotations()
        Return a collection of all annotations declared in this type declaration.
      • isFunctionalInterface

        boolean isFunctionalInterface()
        This means that the type has a functional method. Conceptually, a functional interface has exactly one abstract method. Typically these classes has the FunctionInterface annotation but this is not mandatory.