Class JavaParserClassDeclaration

  • All Implemented Interfaces:
    com.github.javaparser.resolution.declarations.AssociableToAST<com.github.javaparser.ast.Node>, com.github.javaparser.resolution.declarations.HasAccessSpecifier, com.github.javaparser.resolution.declarations.ResolvedClassDeclaration, com.github.javaparser.resolution.declarations.ResolvedDeclaration, com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration, com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration, com.github.javaparser.resolution.declarations.ResolvedTypeParametrizable, MethodUsageResolutionCapability, com.github.javaparser.symbolsolver.logic.MethodResolutionCapability

    public class JavaParserClassDeclaration
    extends com.github.javaparser.symbolsolver.logic.AbstractClassDeclaration
    implements MethodUsageResolutionCapability
    Author:
    Federico Tomassetti
    • Constructor Summary

      Constructors 
      Constructor Description
      JavaParserClassDeclaration​(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration wrappedNode, com.github.javaparser.symbolsolver.model.resolution.TypeSolver typeSolver)  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      com.github.javaparser.ast.Modifier.Keyword accessSpecifier()  
      boolean canBeAssignedTo​(com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration other)  
      Optional<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration> containerType()  
      boolean equals​(Object o)  
      List<com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration> getAllFields()  
      List<com.github.javaparser.resolution.types.ResolvedReferenceType> getAncestors​(boolean acceptIncompleteList)  
      String getClassName()  
      List<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration> getConstructors()  
      Context getContext()
      Deprecated.
      Set<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> getDeclaredMethods()  
      List<com.github.javaparser.resolution.types.ResolvedReferenceType> getInterfaces()  
      String getName()  
      String getPackageName()  
      String getQualifiedName()  
      com.github.javaparser.resolution.types.ResolvedReferenceType getSuperClass()  
      List<com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration> getTypeParameters()  
      com.github.javaparser.resolution.types.ResolvedType getUsage​(com.github.javaparser.ast.Node node)  
      com.github.javaparser.ast.body.ClassOrInterfaceDeclaration getWrappedNode()
      Returns the JavaParser node associated with this JavaParserClassDeclaration.
      boolean hasDirectlyAnnotation​(String canonicalName)  
      int hashCode()  
      Set<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration> internalTypes()  
      boolean isAssignableBy​(com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration other)  
      boolean isAssignableBy​(com.github.javaparser.resolution.types.ResolvedType type)  
      boolean isInterface()  
      boolean isTypeParameter()  
      protected com.github.javaparser.resolution.types.ResolvedReferenceType object()  
      com.github.javaparser.symbolsolver.model.resolution.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> solveMethod​(String name, List<com.github.javaparser.resolution.types.ResolvedType> parameterTypes)  
      com.github.javaparser.symbolsolver.model.resolution.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> solveMethod​(String name, List<com.github.javaparser.resolution.types.ResolvedType> argumentsTypes, boolean staticOnly)  
      Optional<com.github.javaparser.resolution.MethodUsage> solveMethodAsUsage​(String name, List<com.github.javaparser.resolution.types.ResolvedType> argumentTypes, Context invocationContext, List<com.github.javaparser.resolution.types.ResolvedType> typeParameters)  
      com.github.javaparser.symbolsolver.model.resolution.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration> solveType​(String name)
      Deprecated.
      Optional<com.github.javaparser.ast.Node> toAst()  
      String toString()  
      • Methods inherited from class com.github.javaparser.symbolsolver.logic.AbstractClassDeclaration

        asClass, getAllInterfaces, getAllSuperClasses, hasName
      • Methods inherited from class com.github.javaparser.symbolsolver.logic.AbstractTypeDeclaration

        getAllMethods, isFunctionalInterface
      • Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedClassDeclaration

        isClass
      • Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedDeclaration

        asEnumConstant, asField, asMethod, asParameter, isEnumConstant, isField, isMethod, isParameter, isVariable
      • Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration

        asReferenceType, findTypeParameter, getAllAncestors, getAllMethods, getAllNonStaticFields, getAllStaticFields, getAncestors, getDeclaredFields, getField, getVisibleField, getVisibleFields, hasAnnotation, hasField, hasVisibleField, isFunctionalInterface
      • Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration

        asEnum, asInterface, asType, asTypeParameter, getId, getInternalType, hasInternalType, isAnonymousClass, isEnum, isType
      • Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedTypeParametrizable

        isGeneric
    • Constructor Detail

      • JavaParserClassDeclaration

        public JavaParserClassDeclaration​(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration wrappedNode,
                                          com.github.javaparser.symbolsolver.model.resolution.TypeSolver typeSolver)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getAllFields

        public List<com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration> getAllFields()
        Specified by:
        getAllFields in interface com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
      • solveMethod

        public com.github.javaparser.symbolsolver.model.resolution.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> solveMethod​(String name,
                                                                                                                                                                        List<com.github.javaparser.resolution.types.ResolvedType> parameterTypes)
      • getContext

        @Deprecated
        public Context getContext()
        Deprecated.
        This method is deprecated because the context is an implementation detail that should not be exposed. Ideally this method should become private. For this reason all further usages of this method are discouraged.
      • getUsage

        public com.github.javaparser.resolution.types.ResolvedType getUsage​(com.github.javaparser.ast.Node node)
      • getName

        public String getName()
        Specified by:
        getName in interface com.github.javaparser.resolution.declarations.ResolvedDeclaration
      • getSuperClass

        public com.github.javaparser.resolution.types.ResolvedReferenceType getSuperClass()
        Specified by:
        getSuperClass in interface com.github.javaparser.resolution.declarations.ResolvedClassDeclaration
      • getInterfaces

        public List<com.github.javaparser.resolution.types.ResolvedReferenceType> getInterfaces()
        Specified by:
        getInterfaces in interface com.github.javaparser.resolution.declarations.ResolvedClassDeclaration
      • getConstructors

        public List<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration> getConstructors()
        Specified by:
        getConstructors in interface com.github.javaparser.resolution.declarations.ResolvedClassDeclaration
        Specified by:
        getConstructors in interface com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
      • hasDirectlyAnnotation

        public boolean hasDirectlyAnnotation​(String canonicalName)
        Specified by:
        hasDirectlyAnnotation in interface com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
      • isInterface

        public boolean isInterface()
        Specified by:
        isInterface in interface com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
      • getPackageName

        public String getPackageName()
        Specified by:
        getPackageName in interface com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
      • getClassName

        public String getClassName()
        Specified by:
        getClassName in interface com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
      • getQualifiedName

        public String getQualifiedName()
        Specified by:
        getQualifiedName in interface com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
      • isAssignableBy

        public boolean isAssignableBy​(com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration other)
        Specified by:
        isAssignableBy in interface com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
      • isAssignableBy

        public boolean isAssignableBy​(com.github.javaparser.resolution.types.ResolvedType type)
        Specified by:
        isAssignableBy in interface com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
      • canBeAssignedTo

        public boolean canBeAssignedTo​(com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration other)
        Specified by:
        canBeAssignedTo in interface com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
      • isTypeParameter

        public boolean isTypeParameter()
        Specified by:
        isTypeParameter in interface com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
      • solveType

        @Deprecated
        public com.github.javaparser.symbolsolver.model.resolution.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration> solveType​(String name)
        Deprecated.
        Resolution should move out of declarations, so that they are pure declarations and the resolution should work for JavaParser, Reflection and Javassist classes in the same way and not be specific to the three implementations.
      • solveMethod

        public com.github.javaparser.symbolsolver.model.resolution.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> solveMethod​(String name,
                                                                                                                                                                        List<com.github.javaparser.resolution.types.ResolvedType> argumentsTypes,
                                                                                                                                                                        boolean staticOnly)
        Specified by:
        solveMethod in interface com.github.javaparser.symbolsolver.logic.MethodResolutionCapability
      • getAncestors

        public List<com.github.javaparser.resolution.types.ResolvedReferenceType> getAncestors​(boolean acceptIncompleteList)
        Specified by:
        getAncestors in interface com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
      • getDeclaredMethods

        public Set<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> getDeclaredMethods()
        Specified by:
        getDeclaredMethods in interface com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
      • getTypeParameters

        public List<com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration> getTypeParameters()
        Specified by:
        getTypeParameters in interface com.github.javaparser.resolution.declarations.ResolvedTypeParametrizable
      • getWrappedNode

        public com.github.javaparser.ast.body.ClassOrInterfaceDeclaration getWrappedNode()
        Returns the JavaParser node associated with this JavaParserClassDeclaration.
        Returns:
        A visitable JavaParser node wrapped by this object.
      • accessSpecifier

        public com.github.javaparser.ast.Modifier.Keyword accessSpecifier()
        Specified by:
        accessSpecifier in interface com.github.javaparser.resolution.declarations.HasAccessSpecifier
      • toAst

        public Optional<com.github.javaparser.ast.Node> toAst()
        Specified by:
        toAst in interface com.github.javaparser.resolution.declarations.AssociableToAST<com.github.javaparser.ast.Node>
      • object

        protected com.github.javaparser.resolution.types.ResolvedReferenceType object()
        Specified by:
        object in class com.github.javaparser.symbolsolver.logic.AbstractClassDeclaration
      • internalTypes

        public Set<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration> internalTypes()
        Specified by:
        internalTypes in interface com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
      • containerType

        public Optional<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration> containerType()
        Specified by:
        containerType in interface com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration