Class JavassistRecordDeclaration
- java.lang.Object
-
- com.github.javaparser.symbolsolver.logic.AbstractTypeDeclaration
-
- com.github.javaparser.symbolsolver.javassistmodel.JavassistRecordDeclaration
-
- All Implemented Interfaces:
AssociableToAST,HasAccessSpecifier,ResolvedDeclaration,ResolvedRecordDeclaration,ResolvedReferenceTypeDeclaration,ResolvedTypeDeclaration,ResolvedTypeParametrizable,MethodResolutionCapability,MethodUsageResolutionCapability,SymbolResolutionCapability
public class JavassistRecordDeclaration extends AbstractTypeDeclaration implements ResolvedRecordDeclaration, MethodUsageResolutionCapability, SymbolResolutionCapability, MethodResolutionCapability
-
-
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 JavassistRecordDeclaration(javassist.CtClass ctClass, TypeSolver typeSolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AccessSpecifieraccessSpecifier()The access specifier of this element.booleancanBeAssignedTo(ResolvedReferenceTypeDeclaration other)Can we assign instances of the type defined by this declaration to variables having the type defined by the given type?java.util.Optional<ResolvedReferenceTypeDeclaration>containerType()Get the ReferenceTypeDeclaration enclosing this declaration.booleanequals(java.lang.Object o)java.util.List<ResolvedFieldDeclaration>getAllFields()Return a list of all fields, either declared in this declaration or inherited.java.util.List<ResolvedReferenceType>getAllInterfaces()Return all the interfaces implemented by this class, either directly or indirectly, including the interfaces extended by interfaces it implements.java.util.List<ResolvedReferenceType>getAllSuperClasses()Get all superclasses, with all the type typeParametersValues expressed as functions of the type typeParametersValues of this declaration.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.lang.StringgetClassName()The class(es) wrapping this type.java.util.List<ResolvedConstructorDeclaration>getConstructors()List of constructors available for the class.java.util.Set<ResolvedAnnotationDeclaration>getDeclaredAnnotations()Return a collection of all annotations declared in this type declaration.java.util.Set<ResolvedMethodDeclaration>getDeclaredMethods()Return a list of all the methods declared in this type declaration.private java.lang.String[]getInterfaceFQNs()java.util.List<ResolvedReferenceType>getInterfaces()Return all the interfaces implemented directly by this class.ResolvedReferenceTypeDeclarationgetInternalType(java.lang.String name)Returns a type declaration for the internal type based on name.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.Optional<ResolvedReferenceType>getSuperClass()This is a ReferenceTypeUsage because it could contain type typeParametersValues.private java.lang.StringgetSuperclassFQN()java.util.List<ResolvedTypeParameterDeclaration>getTypeParameters()The list of type parameters defined on this element.ResolvedTypegetUsage(Node node)booleanhasDirectlyAnnotation(java.lang.String canonicalName)Has the type at least one annotation declared having the specified qualified name?inthashCode()booleanhasInternalType(java.lang.String name)Does this type contain an internal type with the given name? (Does not include internal types inside internal types).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?booleanisField()Does this declaration represents a class field?booleanisInterface()Is this the declaration of an interface?booleanisParameter()Does this declaration represents a method parameter?booleanisType()Does this declaration represents a type?booleanisTypeParameter()Is this the declaration of a type parameter?SymbolReference<ResolvedMethodDeclaration>solveMethod(java.lang.String name, java.util.List<ResolvedType> argumentsTypes, boolean staticOnly)java.util.Optional<MethodUsage>solveMethodAsUsage(java.lang.String name, java.util.List<ResolvedType> argumentsTypes, Context invokationContext, java.util.List<ResolvedType> typeParameterValues)Deprecated.SymbolReference<? extends ResolvedValueDeclaration>solveSymbol(java.lang.String name, TypeSolver typeSolver)private SymbolReference<? extends ResolvedValueDeclaration>solveSymbolForFQN(java.lang.String symbolName, java.lang.String fqn)java.lang.StringtoString()-
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, toAst
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedDeclaration
asEnumConstant, asField, asMethod, asParameter, asTypePattern, hasName, isEnumConstant, isMethod, isTypePattern, isVariable
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedRecordDeclaration
asRecord, isRecord
-
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
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
asAnnotation, asClass, asEnum, asInterface, asType, asTypeParameter, getId, isAnnotation, isAnonymousClass, isClass, isEnum
-
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
-
JavassistRecordDeclaration
public JavassistRecordDeclaration(javassist.CtClass ctClass, TypeSolver typeSolver)
-
-
Method Detail
-
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
-
getDeclaredAnnotations
public java.util.Set<ResolvedAnnotationDeclaration> getDeclaredAnnotations()
Description copied from interface:ResolvedReferenceTypeDeclarationReturn a collection of all annotations declared in this type declaration.- Specified by:
getDeclaredAnnotationsin interfaceResolvedReferenceTypeDeclaration
-
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
-
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
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein 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
-
solveMethodAsUsage
@Deprecated public java.util.Optional<MethodUsage> solveMethodAsUsage(java.lang.String name, java.util.List<ResolvedType> argumentsTypes, Context invokationContext, java.util.List<ResolvedType> typeParameterValues)
Deprecated.- Specified by:
solveMethodAsUsagein interfaceMethodUsageResolutionCapability
-
solveSymbol
public SymbolReference<? extends ResolvedValueDeclaration> solveSymbol(java.lang.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(java.lang.String symbolName, java.lang.String fqn)
-
getInterfaceFQNs
private java.lang.String[] getInterfaceFQNs()
-
getSuperclassFQN
private java.lang.String getSuperclassFQN()
-
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.
-
getUsage
public ResolvedType getUsage(Node node)
-
canBeAssignedTo
public boolean canBeAssignedTo(ResolvedReferenceTypeDeclaration other)
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
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
-
isTypeParameter
public boolean isTypeParameter()
Description copied from interface:ResolvedTypeDeclarationIs this the declaration of a type parameter?- Specified by:
isTypeParameterin interfaceResolvedTypeDeclaration
-
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
-
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
-
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
-
getSuperClass
public java.util.Optional<ResolvedReferenceType> getSuperClass()
Description copied from interface:ResolvedRecordDeclarationThis 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 interfaceResolvedRecordDeclaration
-
getInterfaces
public java.util.List<ResolvedReferenceType> getInterfaces()
Description copied from interface:ResolvedRecordDeclarationReturn 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 interfaceResolvedRecordDeclaration
-
getAllSuperClasses
public final java.util.List<ResolvedReferenceType> getAllSuperClasses()
Description copied from interface:ResolvedRecordDeclarationGet all superclasses, with all the type typeParametersValues expressed as functions of the type typeParametersValues of this declaration.- Specified by:
getAllSuperClassesin interfaceResolvedRecordDeclaration
-
getAllInterfaces
public final java.util.List<ResolvedReferenceType> getAllInterfaces()
Description copied from interface:ResolvedRecordDeclarationReturn all the interfaces implemented by this class, either directly or indirectly, including the interfaces extended by interfaces it implements.Get all interfaces, with all the type typeParametersValues expressed as functions of the type typeParametersValues of this declaration.
- Specified by:
getAllInterfacesin interfaceResolvedRecordDeclaration
-
isInterface
public boolean isInterface()
Description copied from interface:ResolvedTypeDeclarationIs this the declaration of an interface?- Specified by:
isInterfacein interfaceResolvedTypeDeclaration
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getTypeParameters
public java.util.List<ResolvedTypeParameterDeclaration> getTypeParameters()
Description copied from interface:ResolvedTypeParametrizableThe list of type parameters defined on this element.- Specified by:
getTypeParametersin interfaceResolvedTypeParametrizable
-
accessSpecifier
public AccessSpecifier accessSpecifier()
Description copied from interface:HasAccessSpecifierThe access specifier of this element.- Specified by:
accessSpecifierin interfaceHasAccessSpecifier
-
getConstructors
public java.util.List<ResolvedConstructorDeclaration> getConstructors()
Description copied from interface:ResolvedRecordDeclarationList of constructors available for the class. This list should also include the default constructor.- Specified by:
getConstructorsin interfaceResolvedRecordDeclaration- Specified by:
getConstructorsin interfaceResolvedReferenceTypeDeclaration
-
containerType
public java.util.Optional<ResolvedReferenceTypeDeclaration> containerType()
Description copied from interface:ResolvedTypeDeclarationGet the ReferenceTypeDeclaration enclosing this declaration.- Specified by:
containerTypein interfaceResolvedTypeDeclaration
-
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
-
getInternalType
public ResolvedReferenceTypeDeclaration getInternalType(java.lang.String name)
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
public boolean hasInternalType(java.lang.String name)
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
-
solveMethod
public SymbolReference<ResolvedMethodDeclaration> solveMethod(java.lang.String name, java.util.List<ResolvedType> argumentsTypes, boolean staticOnly)
- Specified by:
solveMethodin interfaceMethodResolutionCapability
-
-