Class JavassistAnnotationDeclaration
- java.lang.Object
-
- com.github.javaparser.symbolsolver.logic.AbstractTypeDeclaration
-
- com.github.javaparser.symbolsolver.javassistmodel.JavassistAnnotationDeclaration
-
- All Implemented Interfaces:
AssociableToAST,ResolvedAnnotationDeclaration,ResolvedDeclaration,ResolvedReferenceTypeDeclaration,ResolvedTypeDeclaration,ResolvedTypeParametrizable
public class JavassistAnnotationDeclaration extends AbstractTypeDeclaration implements ResolvedAnnotationDeclaration
-
-
Field Summary
Fields Modifier and Type Field Description private javassist.CtClassctClassprivate JavassistTypeDeclarationAdapterjavassistTypeDeclarationAdapterprivate TypeSolvertypeSolver-
Fields inherited from interface com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
breadthFirstFunc, depthFirstFunc, JAVA_IO_SERIALIZABLE, JAVA_LANG_COMPARABLE, JAVA_LANG_ENUM, JAVA_LANG_OBJECT, JAVA_LANG_RECORD
-
-
Constructor Summary
Constructors Constructor Description JavassistAnnotationDeclaration(javassist.CtClass ctClass, TypeSolver typeSolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<ResolvedReferenceTypeDeclaration>containerType()Get the ReferenceTypeDeclaration enclosing this declaration.java.util.List<ResolvedFieldDeclaration>getAllFields()Return a list of all fields, either declared in this declaration or inherited.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.java.util.List<ResolvedAnnotationMemberDeclaration>getAnnotationMembers()java.lang.StringgetClassName()The class(es) wrapping this type.java.util.List<ResolvedConstructorDeclaration>getConstructors()java.util.Set<ResolvedMethodDeclaration>getDeclaredMethods()Return a list of all the methods declared in this type declaration.java.lang.StringgetName()Should return the name or return null if the name is not available.java.lang.StringgetPackageName()The package name of the type.java.lang.StringgetQualifiedName()The fully qualified name of the type declared.java.util.List<ResolvedTypeParameterDeclaration>getTypeParameters()Annotation declarations cannot have type parameters and hence this method always returns an empty list.booleanhasDirectlyAnnotation(java.lang.String canonicalName)Has the type at least one annotation declared having the specified qualified name?java.util.Set<ResolvedReferenceTypeDeclaration>internalTypes()Get the list of types defined inside the current type.booleanisAssignableBy(ResolvedReferenceTypeDeclaration other)Can 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?booleanisInheritable()java.lang.StringtoString()-
Methods inherited from class com.github.javaparser.symbolsolver.logic.AbstractTypeDeclaration
getAllMethods, isFunctionalInterface, isRecordType
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.javaparser.resolution.declarations.AssociableToAST
toAst, toAst
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedAnnotationDeclaration
asAnnotation, isAnnotation
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedDeclaration
asEnumConstant, asField, asMethod, asParameter, asTypePattern, hasName, isEnumConstant, isField, isMethod, isParameter, isTypePattern, isVariable
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
asReferenceType, canBeAssignedTo, findTypeParameter, getAllAncestors, getAllAncestors, getAllMethods, getAllNonStaticFields, getAllStaticFields, getAncestors, getDeclaredAnnotation, getDeclaredAnnotations, getDeclaredFields, getField, getVisibleField, getVisibleFields, hasAnnotation, hasField, hasVisibleField, isFunctionalInterface, isInheritedAnnotation, isJavaLangEnum, isJavaLangObject, isJavaLangRecord, isReferenceType
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
asClass, asEnum, asInterface, asRecord, asType, asTypeParameter, getId, getInternalType, hasInternalType, isAnonymousClass, isClass, isEnum, isInterface, isRecord, isType, isTypeParameter
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedTypeParametrizable
isGeneric
-
-
-
-
Field Detail
-
ctClass
private javassist.CtClass ctClass
-
typeSolver
private TypeSolver typeSolver
-
javassistTypeDeclarationAdapter
private JavassistTypeDeclarationAdapter javassistTypeDeclarationAdapter
-
-
Constructor Detail
-
JavassistAnnotationDeclaration
public JavassistAnnotationDeclaration(javassist.CtClass ctClass, TypeSolver typeSolver)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getPackageName
public java.lang.String getPackageName()
Description copied from interface:ResolvedTypeDeclarationThe package name of the type.- Specified by:
getPackageNamein interfaceResolvedTypeDeclaration
-
getClassName
public java.lang.String getClassName()
Description copied from interface:ResolvedTypeDeclarationThe class(es) wrapping this type.- Specified by:
getClassNamein interfaceResolvedTypeDeclaration
-
getQualifiedName
public java.lang.String getQualifiedName()
Description copied from interface:ResolvedTypeDeclarationThe fully qualified name of the type declared.- Specified by:
getQualifiedNamein interfaceResolvedTypeDeclaration
-
isAssignableBy
public boolean isAssignableBy(ResolvedType type)
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
-
getAllFields
public java.util.List<ResolvedFieldDeclaration> getAllFields()
Description copied from interface:ResolvedReferenceTypeDeclarationReturn a list of all fields, either declared in this declaration or inherited.- Specified by:
getAllFieldsin interfaceResolvedReferenceTypeDeclaration
-
isAssignableBy
public boolean isAssignableBy(ResolvedReferenceTypeDeclaration other)
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
-
getAncestors
public java.util.List<ResolvedReferenceType> getAncestors(boolean acceptIncompleteList)
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.
-
internalTypes
public java.util.Set<ResolvedReferenceTypeDeclaration> internalTypes()
Description copied from interface:ResolvedTypeDeclarationGet the list of types defined inside the current type.- Specified by:
internalTypesin interfaceResolvedTypeDeclaration
-
getDeclaredMethods
public java.util.Set<ResolvedMethodDeclaration> getDeclaredMethods()
Description copied from interface:ResolvedReferenceTypeDeclarationReturn a list of all the methods declared in this type declaration.- Specified by:
getDeclaredMethodsin interfaceResolvedReferenceTypeDeclaration
-
hasDirectlyAnnotation
public boolean hasDirectlyAnnotation(java.lang.String canonicalName)
Description copied from interface:ResolvedReferenceTypeDeclarationHas the type at least one annotation declared having the specified qualified name?- Specified by:
hasDirectlyAnnotationin interfaceResolvedReferenceTypeDeclaration
-
getName
public java.lang.String getName()
Description copied from interface:ResolvedDeclarationShould return the name or return null if the name is not available.- Specified by:
getNamein interfaceResolvedDeclaration
-
getTypeParameters
public java.util.List<ResolvedTypeParameterDeclaration> getTypeParameters()
Annotation declarations cannot have type parameters and hence this method always returns an empty list.- Specified by:
getTypeParametersin interfaceResolvedTypeParametrizable- Returns:
- An empty list.
-
containerType
public java.util.Optional<ResolvedReferenceTypeDeclaration> containerType()
Description copied from interface:ResolvedTypeDeclarationGet the ReferenceTypeDeclaration enclosing this declaration.- Specified by:
containerTypein interfaceResolvedTypeDeclaration
-
getConstructors
public java.util.List<ResolvedConstructorDeclaration> getConstructors()
- Specified by:
getConstructorsin interfaceResolvedReferenceTypeDeclaration
-
getAnnotationMembers
public java.util.List<ResolvedAnnotationMemberDeclaration> getAnnotationMembers()
- Specified by:
getAnnotationMembersin interfaceResolvedAnnotationDeclaration
-
isInheritable
public boolean isInheritable()
- Specified by:
isInheritablein interfaceResolvedAnnotationDeclaration
-
-