Class ReflectionInterfaceDeclaration
java.lang.Object
com.github.javaparser.symbolsolver.logic.AbstractTypeDeclaration
com.github.javaparser.symbolsolver.reflectionmodel.ReflectionInterfaceDeclaration
- All Implemented Interfaces:
AssociableToAST, HasAccessSpecifier, ResolvedDeclaration, ResolvedInterfaceDeclaration, ResolvedReferenceTypeDeclaration, ResolvedTypeDeclaration, ResolvedTypeParametrizable, MethodResolutionCapability, MethodUsageResolutionCapability, SymbolResolutionCapability
public class ReflectionInterfaceDeclaration
extends AbstractTypeDeclaration
implements ResolvedInterfaceDeclaration, MethodResolutionCapability, MethodUsageResolutionCapability, SymbolResolutionCapability
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Class<?> Fieldsprivate ReflectionClassAdapterprivate TypeSolverFields inherited from interface ResolvedReferenceTypeDeclaration
breadthFirstFunc, depthFirstFunc, JAVA_IO_SERIALIZABLE, JAVA_LANG_COMPARABLE, JAVA_LANG_ENUM, JAVA_LANG_OBJECT, JAVA_LANG_RECORD -
Constructor Summary
ConstructorsConstructorDescriptionReflectionInterfaceDeclaration(Class<?> clazz, TypeSolver typeSolver) Constructor -
Method Summary
Modifier and TypeMethodDescriptionThe access specifier of this element.Return this as a InterfaceDeclaration or throw UnsupportedOperationException.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.Return a list of all the methods declared in this type declaration.Note that the type of the field should be expressed using the type variables of this particular type.Return the list of interfaces extended directly by this one.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.The list of type parameters defined on this element.booleanhasDirectlyAnnotation(String canonicalName) Has the type at least one annotation declared having the specified qualified name?booleanHas this type a field with the given name?inthashCode()Get the list of types defined inside the current type.booleanPublic methodsbooleanisAssignableBy(ResolvedType type) Can we assign instances of the given type to variables having the type defined by this declaration?booleanIs this the declaration of an interface?booleanIs this the declaration of a type parameter?solveMethod(String name, List<ResolvedType> parameterTypes, boolean staticOnly) Deprecated.solveMethodAsUsage(String name, List<ResolvedType> parameterTypes, Context invokationContext, List<ResolvedType> typeParameterValues) SymbolReference<? extends ResolvedValueDeclaration> solveSymbol(String name, TypeSolver typeSolver) toString()Methods inherited from class AbstractTypeDeclaration
getAllMethods, isFunctionalInterface, isRecordTypeMethods inherited from interface AssociableToAST
toAst, toAstMethods inherited from interface ResolvedDeclaration
asEnumConstant, asField, asMethod, asParameter, asTypePattern, hasName, isEnumConstant, isField, isMethod, isParameter, isTypePattern, isVariableMethods inherited from interface ResolvedInterfaceDeclaration
getAllInterfacesExtendedMethods inherited from interface ResolvedReferenceTypeDeclaration
asReferenceType, findTypeParameter, getAllAncestors, getAllAncestors, getAllMethods, getAllNonStaticFields, getAllStaticFields, getAncestors, getDeclaredAnnotation, getDeclaredAnnotations, getDeclaredFields, getVisibleField, getVisibleFields, hasAnnotation, hasVisibleField, isFunctionalInterface, isInheritedAnnotation, isJavaLangEnum, isJavaLangObject, isJavaLangRecord, isReferenceTypeMethods inherited from interface ResolvedTypeDeclaration
asAnnotation, asClass, asEnum, asRecord, asType, asTypeParameter, getId, getInternalType, hasInternalType, isAnnotation, isAnonymousClass, isClass, isEnum, isRecord, isTypeMethods inherited from interface ResolvedTypeParametrizable
isGeneric
-
Field Details
-
clazz
Fields -
typeSolver
-
reflectionClassAdapter
-
-
Constructor Details
-
ReflectionInterfaceDeclaration
Constructor
-
-
Method Details
-
isAssignableBy
Public methods- Specified by:
isAssignableByin interfaceResolvedReferenceTypeDeclaration
-
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
-
solveMethod
@Deprecated public SymbolReference<ResolvedMethodDeclaration> solveMethod(String name, List<ResolvedType> parameterTypes, boolean staticOnly) Deprecated.- Specified by:
solveMethodin interfaceMethodResolutionCapability
-
toString
-
getUsage
-
equals
-
hashCode
-
solveMethodAsUsage
public Optional<MethodUsage> solveMethodAsUsage(String name, List<ResolvedType> parameterTypes, Context invokationContext, List<ResolvedType> typeParameterValues) - Specified by:
solveMethodAsUsagein interfaceMethodUsageResolutionCapability
-
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
-
getField
Description copied from interface:ResolvedReferenceTypeDeclarationNote that the type of the field should be expressed using the type variables of this particular type. Consider for example:class Foo
{ E field; } class Bar extends Foo
{ } When calling getField("field") on Foo I should get a FieldDeclaration with type E, while calling it on Bar I should get a FieldDeclaration with type String.
- Specified by:
getFieldin interfaceResolvedReferenceTypeDeclaration
-
getAllFields
Description copied from interface:ResolvedReferenceTypeDeclarationReturn a list of all fields, either declared in this declaration or inherited.- Specified by:
getAllFieldsin interfaceResolvedReferenceTypeDeclaration
-
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.
-
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.
-
getDeclaredMethods
Description copied from interface:ResolvedReferenceTypeDeclarationReturn a list of all the methods declared in this type declaration.- Specified by:
getDeclaredMethodsin interfaceResolvedReferenceTypeDeclaration
-
hasField
Description copied from interface:ResolvedReferenceTypeDeclarationHas this type a field with the given name?- Specified by:
hasFieldin interfaceResolvedReferenceTypeDeclaration
-
getName
Description copied from interface:ResolvedDeclarationShould return the name or return null if the name is not available.- Specified by:
getNamein interfaceResolvedDeclaration
-
isInterface
public boolean isInterface()Description copied from interface:ResolvedTypeDeclarationIs this the declaration of an interface?- Specified by:
isInterfacein interfaceResolvedInterfaceDeclaration- Specified by:
isInterfacein interfaceResolvedTypeDeclaration
-
getInterfacesExtended
Description copied from interface:ResolvedInterfaceDeclarationReturn the list of interfaces extended directly by this one.- Specified by:
getInterfacesExtendedin interfaceResolvedInterfaceDeclaration
-
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
-
asInterface
Description copied from interface:ResolvedTypeDeclarationReturn this as a InterfaceDeclaration or throw UnsupportedOperationException.- Specified by:
asInterfacein interfaceResolvedTypeDeclaration
-
hasDirectlyAnnotation
Description copied from interface:ResolvedReferenceTypeDeclarationHas the type at least one annotation declared having the specified qualified name?- Specified by:
hasDirectlyAnnotationin interfaceResolvedReferenceTypeDeclaration
-
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
- Specified by:
getConstructorsin interfaceResolvedReferenceTypeDeclaration
-