Class JavaParserClassDeclaration
- java.lang.Object
-
- com.github.javaparser.symbolsolver.logic.AbstractTypeDeclaration
-
- com.github.javaparser.symbolsolver.logic.AbstractClassDeclaration
-
- com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclaration
-
- All Implemented Interfaces:
com.github.javaparser.resolution.declarations.AssociableToAST,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,com.github.javaparser.resolution.logic.MethodResolutionCapability,MethodUsageResolutionCapability,SymbolResolutionCapability
public class JavaParserClassDeclaration extends AbstractClassDeclaration implements MethodUsageResolutionCapability, SymbolResolutionCapability
- Author:
- Federico Tomassetti
-
-
Constructor Summary
Constructors Constructor Description JavaParserClassDeclaration(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration wrappedNode, com.github.javaparser.resolution.TypeSolver typeSolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description com.github.javaparser.ast.AccessSpecifieraccessSpecifier()booleancanBeAssignedTo(com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration other)Optional<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration>containerType()booleanequals(Object o)List<com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration>getAllFields()List<com.github.javaparser.resolution.types.ResolvedReferenceType>getAncestors(boolean acceptIncompleteList)StringgetClassName()List<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration>getConstructors()com.github.javaparser.resolution.ContextgetContext()Deprecated.Set<com.github.javaparser.resolution.declarations.ResolvedAnnotationDeclaration>getDeclaredAnnotations()Set<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration>getDeclaredMethods()List<com.github.javaparser.resolution.types.ResolvedReferenceType>getInterfaces()StringgetName()StringgetPackageName()StringgetQualifiedName()Optional<com.github.javaparser.resolution.types.ResolvedReferenceType>getSuperClass()List<com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration>getTypeParameters()com.github.javaparser.resolution.types.ResolvedTypegetUsage(com.github.javaparser.ast.Node node)com.github.javaparser.ast.body.ClassOrInterfaceDeclarationgetWrappedNode()Returns the JavaParser node associated with this JavaParserClassDeclaration.booleanhasDirectlyAnnotation(String canonicalName)inthashCode()Set<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration>internalTypes()booleanisAssignableBy(com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration other)booleanisAssignableBy(com.github.javaparser.resolution.types.ResolvedType type)booleanisInterface()booleanisTypeParameter()protected com.github.javaparser.resolution.types.ResolvedReferenceTypeobject()An implementation of the Object class.com.github.javaparser.resolution.model.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration>solveMethod(String name, List<com.github.javaparser.resolution.types.ResolvedType> parameterTypes)com.github.javaparser.resolution.model.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, com.github.javaparser.resolution.Context invocationContext, List<com.github.javaparser.resolution.types.ResolvedType> typeParameters)com.github.javaparser.resolution.model.SymbolReference<? extends com.github.javaparser.resolution.declarations.ResolvedValueDeclaration>solveSymbol(String name, com.github.javaparser.resolution.TypeSolver typeSolver)com.github.javaparser.resolution.model.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration>solveType(String name)Deprecated.Optional<com.github.javaparser.ast.Node>toAst()StringtoString()-
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, isRecordType
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.javaparser.resolution.declarations.AssociableToAST
toAst
-
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, asTypePattern, isEnumConstant, isField, isMethod, isParameter, isTypePattern, isVariable
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
asReferenceType, findTypeParameter, getAllAncestors, getAllAncestors, getAllMethods, getAllNonStaticFields, getAllStaticFields, getAncestors, getDeclaredAnnotation, getDeclaredFields, getField, getVisibleField, getVisibleFields, hasAnnotation, hasField, hasVisibleField, isFunctionalInterface, isInheritedAnnotation, isJavaLangEnum, isJavaLangObject, isJavaLangRecord, isReferenceType
-
-
-
-
Method Detail
-
getAllFields
public List<com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration> getAllFields()
- Specified by:
getAllFieldsin interfacecom.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
-
solveMethod
public com.github.javaparser.resolution.model.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> solveMethod(String name, List<com.github.javaparser.resolution.types.ResolvedType> parameterTypes)
-
solveMethodAsUsage
public Optional<com.github.javaparser.resolution.MethodUsage> solveMethodAsUsage(String name, List<com.github.javaparser.resolution.types.ResolvedType> argumentTypes, com.github.javaparser.resolution.Context invocationContext, List<com.github.javaparser.resolution.types.ResolvedType> typeParameters)
- Specified by:
solveMethodAsUsagein interfaceMethodUsageResolutionCapability
-
getContext
@Deprecated public com.github.javaparser.resolution.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:
getNamein interfacecom.github.javaparser.resolution.declarations.ResolvedDeclaration
-
getSuperClass
public Optional<com.github.javaparser.resolution.types.ResolvedReferenceType> getSuperClass()
- Specified by:
getSuperClassin interfacecom.github.javaparser.resolution.declarations.ResolvedClassDeclaration
-
getInterfaces
public List<com.github.javaparser.resolution.types.ResolvedReferenceType> getInterfaces()
- Specified by:
getInterfacesin interfacecom.github.javaparser.resolution.declarations.ResolvedClassDeclaration
-
getConstructors
public List<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration> getConstructors()
- Specified by:
getConstructorsin interfacecom.github.javaparser.resolution.declarations.ResolvedClassDeclaration- Specified by:
getConstructorsin interfacecom.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
-
hasDirectlyAnnotation
public boolean hasDirectlyAnnotation(String canonicalName)
- Specified by:
hasDirectlyAnnotationin interfacecom.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
-
getDeclaredAnnotations
public Set<com.github.javaparser.resolution.declarations.ResolvedAnnotationDeclaration> getDeclaredAnnotations()
- Specified by:
getDeclaredAnnotationsin interfacecom.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
-
isInterface
public boolean isInterface()
- Specified by:
isInterfacein interfacecom.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
-
getPackageName
public String getPackageName()
- Specified by:
getPackageNamein interfacecom.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
-
getClassName
public String getClassName()
- Specified by:
getClassNamein interfacecom.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
-
getQualifiedName
public String getQualifiedName()
- Specified by:
getQualifiedNamein interfacecom.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
-
isAssignableBy
public boolean isAssignableBy(com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration other)
- Specified by:
isAssignableByin interfacecom.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
-
isAssignableBy
public boolean isAssignableBy(com.github.javaparser.resolution.types.ResolvedType type)
- Specified by:
isAssignableByin interfacecom.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
-
canBeAssignedTo
public boolean canBeAssignedTo(com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration other)
- Specified by:
canBeAssignedToin interfacecom.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
-
isTypeParameter
public boolean isTypeParameter()
- Specified by:
isTypeParameterin interfacecom.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
-
solveType
@Deprecated public com.github.javaparser.resolution.model.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.resolution.model.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> solveMethod(String name, List<com.github.javaparser.resolution.types.ResolvedType> argumentsTypes, boolean staticOnly)
- Specified by:
solveMethodin interfacecom.github.javaparser.resolution.logic.MethodResolutionCapability
-
solveSymbol
public com.github.javaparser.resolution.model.SymbolReference<? extends com.github.javaparser.resolution.declarations.ResolvedValueDeclaration> solveSymbol(String name, com.github.javaparser.resolution.TypeSolver typeSolver)
- Specified by:
solveSymbolin interfaceSymbolResolutionCapability- Parameters:
name- Field / symbol name.typeSolver- Symbol solver to resolve type usage.- Returns:
- Symbol reference of the resolved value.
-
getAncestors
public List<com.github.javaparser.resolution.types.ResolvedReferenceType> getAncestors(boolean acceptIncompleteList)
- Specified by:
getAncestorsin interfacecom.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
-
getDeclaredMethods
public Set<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> getDeclaredMethods()
- Specified by:
getDeclaredMethodsin interfacecom.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
-
getTypeParameters
public List<com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration> getTypeParameters()
- Specified by:
getTypeParametersin interfacecom.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.AccessSpecifier accessSpecifier()
- Specified by:
accessSpecifierin interfacecom.github.javaparser.resolution.declarations.HasAccessSpecifier
-
toAst
public Optional<com.github.javaparser.ast.Node> toAst()
- Specified by:
toAstin interfacecom.github.javaparser.resolution.declarations.AssociableToAST
-
object
protected com.github.javaparser.resolution.types.ResolvedReferenceType object()
Description copied from class:AbstractClassDeclarationAn implementation of the Object class.- Specified by:
objectin classAbstractClassDeclaration
-
internalTypes
public Set<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration> internalTypes()
- Specified by:
internalTypesin interfacecom.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
-
containerType
public Optional<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration> containerType()
- Specified by:
containerTypein interfacecom.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
-
-