Class JavassistClassDeclaration
java.lang.Object
com.github.javaparser.symbolsolver.logic.AbstractTypeDeclaration
com.github.javaparser.symbolsolver.logic.AbstractClassDeclaration
com.github.javaparser.symbolsolver.javassistmodel.JavassistClassDeclaration
- All Implemented Interfaces:
AssociableToAST, HasAccessSpecifier, ResolvedClassDeclaration, ResolvedDeclaration, ResolvedReferenceTypeDeclaration, ResolvedTypeDeclaration, ResolvedTypeParametrizable, MethodResolutionCapability, MethodUsageResolutionCapability, SymbolResolutionCapability
public class JavassistClassDeclaration
extends AbstractClassDeclaration
implements MethodUsageResolutionCapability, SymbolResolutionCapability
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javassist.CtClassprivate JavassistTypeDeclarationAdapterprivate TypeSolverFields inherited from interface ResolvedReferenceTypeDeclaration
breadthFirstFunc, depthFirstFunc, JAVA_IO_SERIALIZABLE, JAVA_LANG_COMPARABLE, JAVA_LANG_ENUM, JAVA_LANG_OBJECT, JAVA_LANG_RECORD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe access specifier of this element.booleanCan we assign instances of the type defined by this declaration to variables having the type defined by the given type?Get the ReferenceTypeDeclaration enclosing this declaration.booleanReturn a list of all fields, either declared in this declaration or inherited.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.The class(es) wrapping this type.List of constructors available for the class.Return a collection of all annotations declared in this type declaration.Return a list of all the methods declared in this type declaration.private String[]Return all the interfaces implemented directly by this class.getInternalType(String name) Returns a type declaration for the internal type based on name.getName()Should return the name or return null if the name is not available.The package name of the type.The fully qualified name of the type declared.This is a ReferenceTypeUsage because it could contain type typeParametersValues.private StringThe list of type parameters defined on this element.booleanhasDirectlyAnnotation(String canonicalName) Has the type at least one annotation declared having the specified qualified name?inthashCode()booleanhasInternalType(String name) Does this type contain an internal type with the given name? (Does not include internal types inside internal types).Get the list of types defined inside the current type.booleanCan we assign instances of the given type to variables having the type defined by this declaration?booleanisAssignableBy(ResolvedType type) Can we assign instances of the given type to variables having the type defined by this declaration?booleanisClass()Is this the declaration of a class? Note that an Enum is not considered a Class in this case.booleanisField()Does this declaration represents a class field?booleanIs this the declaration of an interface?booleanDoes this declaration represents a method parameter?booleanisType()Does this declaration represents a type?booleanIs this the declaration of a type parameter?protected ResolvedReferenceTypeobject()An implementation of the Object class.solveMethod(String name, List<ResolvedType> argumentsTypes, boolean staticOnly) Deprecated.solveMethodAsUsage(String name, List<ResolvedType> argumentsTypes, Context invokationContext, List<ResolvedType> typeParameterValues) Deprecated.SymbolReference<? extends ResolvedValueDeclaration> solveSymbol(String name, TypeSolver typeSolver) private SymbolReference<? extends ResolvedValueDeclaration> solveSymbolForFQN(String symbolName, String fqn) toString()Methods inherited from class AbstractClassDeclaration
asClass, getAllInterfaces, getAllSuperClasses, hasNameMethods inherited from class AbstractTypeDeclaration
getAllMethods, isFunctionalInterface, isRecordTypeMethods inherited from interface AssociableToAST
toAst, toAstMethods inherited from interface ResolvedDeclaration
asEnumConstant, asField, asMethod, asParameter, asTypePattern, isEnumConstant, isMethod, isTypePattern, isVariableMethods inherited from interface ResolvedReferenceTypeDeclaration
asReferenceType, findTypeParameter, getAllAncestors, getAllAncestors, getAllMethods, getAllNonStaticFields, getAllStaticFields, getAncestors, getDeclaredAnnotation, getDeclaredFields, getField, getVisibleField, getVisibleFields, hasAnnotation, hasField, hasVisibleField, isFunctionalInterface, isInheritedAnnotation, isJavaLangEnum, isJavaLangObject, isJavaLangRecord, isReferenceTypeMethods inherited from interface ResolvedTypeDeclaration
asAnnotation, asEnum, asInterface, asRecord, asType, asTypeParameter, getId, isAnnotation, isAnonymousClass, isEnum, isRecordMethods inherited from interface ResolvedTypeParametrizable
isGeneric
-
Field Details
-
ctClass
private javassist.CtClass ctClass -
typeSolver
-
javassistTypeDeclarationAdapter
-
-
Constructor Details
-
JavassistClassDeclaration
-
-
Method Details
-
object
Description copied from class:AbstractClassDeclarationAn implementation of the Object class.- Specified by:
objectin classAbstractClassDeclaration
-
hasDirectlyAnnotation
Description copied from interface:ResolvedReferenceTypeDeclarationHas the type at least one annotation declared having the specified qualified name?- Specified by:
hasDirectlyAnnotationin interfaceResolvedReferenceTypeDeclaration
-
getDeclaredAnnotations
Description copied from interface:ResolvedReferenceTypeDeclarationReturn a collection of all annotations declared in this type declaration.- Specified by:
getDeclaredAnnotationsin interfaceResolvedReferenceTypeDeclaration
-
getDeclaredMethods
Description copied from interface:ResolvedReferenceTypeDeclarationReturn a list of all the methods declared in this type declaration.- Specified by:
getDeclaredMethodsin interfaceResolvedReferenceTypeDeclaration
-
isAssignableBy
Description copied from interface:ResolvedReferenceTypeDeclarationCan we assign instances of the given type to variables having the type defined by this declaration?- Specified by:
isAssignableByin interfaceResolvedReferenceTypeDeclaration
-
equals
-
hashCode
-
getPackageName
Description copied from interface:ResolvedTypeDeclarationThe package name of the type.- Specified by:
getPackageNamein interfaceResolvedTypeDeclaration
-
getClassName
Description copied from interface:ResolvedTypeDeclarationThe class(es) wrapping this type.- Specified by:
getClassNamein interfaceResolvedTypeDeclaration
-
getQualifiedName
Description copied from interface:ResolvedTypeDeclarationThe fully qualified name of the type declared.- Specified by:
getQualifiedNamein interfaceResolvedTypeDeclaration
-
solveMethodAsUsage
@Deprecated public Optional<MethodUsage> solveMethodAsUsage(String name, List<ResolvedType> argumentsTypes, Context invokationContext, List<ResolvedType> typeParameterValues) Deprecated.- Specified by:
solveMethodAsUsagein interfaceMethodUsageResolutionCapability
-
solveSymbol
public SymbolReference<? extends ResolvedValueDeclaration> solveSymbol(String name, 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.
-
solveSymbolForFQN
private SymbolReference<? extends ResolvedValueDeclaration> solveSymbolForFQN(String symbolName, String fqn) -
getInterfaceFQNs
-
getSuperclassFQN
-
getAncestors
Description copied from interface:ResolvedReferenceTypeDeclarationResolves 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
acceptIncompleteListisfalse, then anUnsolvedSymbolExceptionis thrown if any ancestor cannot be resolved. Otherwise, a list of only the resolvable direct ancestors is returned.- Specified by:
getAncestorsin interfaceResolvedReferenceTypeDeclaration- Parameters:
acceptIncompleteList- When set tofalse, this method throws anUnsolvedSymbolExceptionif one or more ancestor could not be resolved. When set totrue, this method does not throw anUnsolvedSymbolException, 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.
-
solveMethod
@Deprecated public SymbolReference<ResolvedMethodDeclaration> solveMethod(String name, List<ResolvedType> argumentsTypes, boolean staticOnly) Deprecated.- Specified by:
solveMethodin interfaceMethodResolutionCapability
-
getUsage
-
canBeAssignedTo
Description copied from interface:ResolvedReferenceTypeDeclarationCan we assign instances of the type defined by this declaration to variables having the type defined by the given type?- Specified by:
canBeAssignedToin interfaceResolvedReferenceTypeDeclaration
-
isAssignableBy
Description copied from interface:ResolvedReferenceTypeDeclarationCan we assign instances of the given type to variables having the type defined by this declaration?- Specified by:
isAssignableByin interfaceResolvedReferenceTypeDeclaration
-
isTypeParameter
public boolean isTypeParameter()Description copied from interface:ResolvedTypeDeclarationIs this the declaration of a type parameter?- Specified by:
isTypeParameterin interfaceResolvedTypeDeclaration
-
getAllFields
Description copied from interface:ResolvedReferenceTypeDeclarationReturn a list of all fields, either declared in this declaration or inherited.- Specified by:
getAllFieldsin interfaceResolvedReferenceTypeDeclaration
-
getName
Description copied from interface:ResolvedDeclarationShould return the name or return null if the name is not available.- Specified by:
getNamein interfaceResolvedDeclaration
-
isField
public boolean isField()Description copied from interface:ResolvedDeclarationDoes this declaration represents a class field?- Specified by:
isFieldin interfaceResolvedDeclaration
-
isParameter
public boolean isParameter()Description copied from interface:ResolvedDeclarationDoes this declaration represents a method parameter?- Specified by:
isParameterin interfaceResolvedDeclaration
-
isType
public boolean isType()Description copied from interface:ResolvedDeclarationDoes this declaration represents a type?- Specified by:
isTypein interfaceResolvedDeclaration- Specified by:
isTypein interfaceResolvedTypeDeclaration
-
isClass
public boolean isClass()Description copied from interface:ResolvedTypeDeclarationIs this the declaration of a class? Note that an Enum is not considered a Class in this case.- Specified by:
isClassin interfaceResolvedClassDeclaration- Specified by:
isClassin interfaceResolvedTypeDeclaration
-
getSuperClass
Description copied from interface:ResolvedClassDeclarationThis is a ReferenceTypeUsage because it could contain type typeParametersValues. For example:class A extends B<Integer, String>.Note that only the Object class should not have a superclass and therefore return empty.
- Specified by:
getSuperClassin interfaceResolvedClassDeclaration
-
getInterfaces
Description copied from interface:ResolvedClassDeclarationReturn all the interfaces implemented directly by this class. It does not include the interfaces implemented by superclasses or extended by the interfaces implemented.- Specified by:
getInterfacesin interfaceResolvedClassDeclaration
-
isInterface
public boolean isInterface()Description copied from interface:ResolvedTypeDeclarationIs this the declaration of an interface?- Specified by:
isInterfacein interfaceResolvedTypeDeclaration
-
toString
-
getTypeParameters
Description copied from interface:ResolvedTypeParametrizableThe list of type parameters defined on this element.- Specified by:
getTypeParametersin interfaceResolvedTypeParametrizable
-
accessSpecifier
Description copied from interface:HasAccessSpecifierThe access specifier of this element.- Specified by:
accessSpecifierin interfaceHasAccessSpecifier
-
getConstructors
Description copied from interface:ResolvedClassDeclarationList of constructors available for the class. This list should also include the default constructor.- Specified by:
getConstructorsin interfaceResolvedClassDeclaration- Specified by:
getConstructorsin interfaceResolvedReferenceTypeDeclaration
-
containerType
Description copied from interface:ResolvedTypeDeclarationGet the ReferenceTypeDeclaration enclosing this declaration.- Specified by:
containerTypein interfaceResolvedTypeDeclaration
-
internalTypes
Description copied from interface:ResolvedTypeDeclarationGet the list of types defined inside the current type.- Specified by:
internalTypesin interfaceResolvedTypeDeclaration
-
getInternalType
Description copied from interface:ResolvedTypeDeclarationReturns a type declaration for the internal type based on name. (Does not include internal types inside internal types).- Specified by:
getInternalTypein interfaceResolvedTypeDeclaration
-
hasInternalType
Description copied from interface:ResolvedTypeDeclarationDoes this type contain an internal type with the given name? (Does not include internal types inside internal types).- Specified by:
hasInternalTypein interfaceResolvedTypeDeclaration
-