Class JavaParserRecordDeclaration
java.lang.Object
com.github.javaparser.symbolsolver.logic.AbstractTypeDeclaration
com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserRecordDeclaration
- All Implemented Interfaces:
com.github.javaparser.resolution.declarations.AssociableToAST, com.github.javaparser.resolution.declarations.HasAccessSpecifier, com.github.javaparser.resolution.declarations.ResolvedDeclaration, com.github.javaparser.resolution.declarations.ResolvedRecordDeclaration, 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 JavaParserRecordDeclaration
extends AbstractTypeDeclaration
implements com.github.javaparser.resolution.declarations.ResolvedRecordDeclaration, com.github.javaparser.resolution.logic.MethodResolutionCapability, MethodUsageResolutionCapability, SymbolResolutionCapability
Heavily based on JavaParserClassDeclaration
- Author:
- Federico Tomassetti
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
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
ConstructorsConstructorDescriptionJavaParserRecordDeclaration(com.github.javaparser.ast.body.RecordDeclaration wrappedNode, com.github.javaparser.resolution.TypeSolver typeSolver) Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.github.javaparser.ast.AccessSpecifierbooleancanBeAssignedTo(com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration other) Optional<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration> booleanPublic methods: from ObjectList<com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration> This method returns both the ResolvedFieldDeclarations for the explicit static fields declared in the record and non-static private fields corresponding to the record parameters.List<com.github.javaparser.resolution.types.ResolvedReferenceType> List<com.github.javaparser.resolution.types.ResolvedReferenceType> List<com.github.javaparser.resolution.types.ResolvedReferenceType> getAncestors(boolean acceptIncompleteList) List<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration> com.github.javaparser.resolution.ContextDeprecated.Set<com.github.javaparser.resolution.declarations.ResolvedAnnotationDeclaration> Set<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> This method returns both the explicit methods declared in the record and the implicit getter methods for the record parameters.List<com.github.javaparser.resolution.types.ResolvedReferenceType> getName()Optional<com.github.javaparser.resolution.types.ResolvedReferenceType> List<com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration> com.github.javaparser.resolution.types.ResolvedTypegetUsage(com.github.javaparser.ast.Node node) com.github.javaparser.ast.body.RecordDeclarationReturns the JavaParser node associated with this JavaParserClassDeclaration.booleanhasDirectlyAnnotation(String canonicalName) inthashCode()Set<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration> Protected methodsbooleanisAssignableBy(com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration other) booleanisAssignableBy(com.github.javaparser.resolution.types.ResolvedType type) com.github.javaparser.resolution.model.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> solveMethod(String name, List<com.github.javaparser.resolution.types.ResolvedType> parameterTypes) Public methodscom.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> Deprecated.Optional<com.github.javaparser.ast.Node> toAst()toString()Methods inherited from class AbstractTypeDeclaration
getAllMethods, isFunctionalInterface, isRecordTypeMethods inherited from interface com.github.javaparser.resolution.declarations.AssociableToAST
toAstMethods inherited from interface com.github.javaparser.resolution.declarations.ResolvedDeclaration
asEnumConstant, asField, asMethod, asParameter, asTypePattern, hasName, isArrayLength, isEnumConstant, isField, isMethod, isParameter, isTypePattern, isVariableMethods inherited from interface com.github.javaparser.resolution.declarations.ResolvedRecordDeclaration
asRecord, isRecordMethods 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, isReferenceTypeMethods inherited from interface com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
asAnnotation, asClass, asEnum, asInterface, asType, asTypeParameter, getId, getInternalType, hasInternalType, isAnnotation, isAnonymousClass, isClass, isEnum, isInterface, isType, isTypeParameterMethods inherited from interface com.github.javaparser.resolution.declarations.ResolvedTypeParametrizable
isGeneric
-
Constructor Details
-
JavaParserRecordDeclaration
public JavaParserRecordDeclaration(com.github.javaparser.ast.body.RecordDeclaration wrappedNode, com.github.javaparser.resolution.TypeSolver typeSolver) Constructors
-
-
Method Details
-
equals
-
hashCode
-
toString
-
getAllFields
This method returns both the ResolvedFieldDeclarations for the explicit static fields declared in the record and non-static private fields corresponding to the record parameters. This is done to make the fields of a record consistent across the various models (since the record parameters are considered fields by the Java compiler and runtime).- Specified by:
getAllFieldsin interfacecom.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
-
solveMethod
-
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.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
- Specified by:
getNamein interfacecom.github.javaparser.resolution.declarations.ResolvedDeclaration
-
getSuperClass
- Specified by:
getSuperClassin interfacecom.github.javaparser.resolution.declarations.ResolvedRecordDeclaration
-
getInterfaces
- Specified by:
getInterfacesin interfacecom.github.javaparser.resolution.declarations.ResolvedRecordDeclaration
-
getAllSuperClasses
- Specified by:
getAllSuperClassesin interfacecom.github.javaparser.resolution.declarations.ResolvedRecordDeclaration
-
getAllInterfaces
- Specified by:
getAllInterfacesin interfacecom.github.javaparser.resolution.declarations.ResolvedRecordDeclaration
-
getConstructors
public List<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration> getConstructors()- Specified by:
getConstructorsin interfacecom.github.javaparser.resolution.declarations.ResolvedRecordDeclaration- Specified by:
getConstructorsin interfacecom.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
-
hasDirectlyAnnotation
- 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
-
getPackageName
- Specified by:
getPackageNamein interfacecom.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
-
getClassName
- Specified by:
getClassNamein interfacecom.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
-
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
-
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()This method returns both the explicit methods declared in the record and the implicit getter methods for the record parameters. This is done for consistency across the various models.- 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.RecordDeclaration 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
- Specified by:
toAstin interfacecom.github.javaparser.resolution.declarations.AssociableToAST
-
internalTypes
public Set<com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration> internalTypes()Protected methods- 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
-