Interface ResolvedTypeDeclaration
-
- All Superinterfaces:
AssociableToAST,ResolvedDeclaration
- All Known Subinterfaces:
ResolvedAnnotationDeclaration,ResolvedClassDeclaration,ResolvedEnumDeclaration,ResolvedInterfaceDeclaration,ResolvedRecordDeclaration,ResolvedReferenceTypeDeclaration,ResolvedTypeParameterDeclaration
public interface ResolvedTypeDeclaration extends ResolvedDeclaration
A declaration of a type. It could be a primitive type, an enum, a class, an interface or a type variable. It cannot be an annotation or an array.- Author:
- Federico Tomassetti
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ResolvedAnnotationDeclarationasAnnotation()Return this as a AnnotationDeclaration or throw UnsupportedOperationException.default ResolvedClassDeclarationasClass()Return this as a ClassDeclaration or throw UnsupportedOperationException.default ResolvedEnumDeclarationasEnum()Return this as a EnumDeclaration or throw UnsupportedOperationException.default ResolvedInterfaceDeclarationasInterface()Return this as a InterfaceDeclaration or throw UnsupportedOperationException.default ResolvedRecordDeclarationasRecord()Return this as a RecordDeclaration or throw UnsupportedOperationException.default ResolvedReferenceTypeDeclarationasReferenceType()default ResolvedTypeDeclarationasType()Return this as a TypeDeclaration or throw an UnsupportedOperationExceptiondefault ResolvedTypeParameterDeclarationasTypeParameter()Return this as a TypeParameterDeclaration or throw UnsupportedOperationException.Optional<ResolvedReferenceTypeDeclaration>containerType()Get the ReferenceTypeDeclaration enclosing this declaration.StringgetClassName()The class(es) wrapping this type.default StringgetId()The ID corresponds most of the type to the qualified name.default ResolvedReferenceTypeDeclarationgetInternalType(String name)Returns a type declaration for the internal type based on name.StringgetPackageName()The package name of the type.StringgetQualifiedName()The fully qualified name of the type declared.default booleanhasInternalType(String name)Does this type contain an internal type with the given name?default Set<ResolvedReferenceTypeDeclaration>internalTypes()Get the list of types defined inside the current type.default booleanisAnnotation()Is this the declaration of an annotation?default booleanisAnonymousClass()Is this type declaration corresponding to an anonymous class?default booleanisClass()Is this the declaration of a class?default booleanisEnum()Is this the declaration of an enum?default booleanisInterface()Is this the declaration of an interface?default booleanisRecord()Is this the declaration of a record class?default booleanisReferenceType()Is this the declaration of a reference type?default booleanisType()Does this declaration represents a type?default booleanisTypeParameter()Is this the declaration of a type parameter?-
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, getName, hasName, isEnumConstant, isField, isMethod, isParameter, isTypePattern, isVariable
-
-
-
-
Method Detail
-
internalTypes
default Set<ResolvedReferenceTypeDeclaration> internalTypes()
Get the list of types defined inside the current type.
-
getInternalType
default ResolvedReferenceTypeDeclaration getInternalType(String name)
Returns a type declaration for the internal type based on name. (Does not include internal types inside internal types).
-
hasInternalType
default boolean hasInternalType(String name)
Does this type contain an internal type with the given name? (Does not include internal types inside internal types).
-
containerType
Optional<ResolvedReferenceTypeDeclaration> containerType()
Get the ReferenceTypeDeclaration enclosing this declaration.
-
isClass
default boolean isClass()
Is this the declaration of a class? Note that an Enum is not considered a Class in this case.
-
isInterface
default boolean isInterface()
Is this the declaration of an interface?
-
isEnum
default boolean isEnum()
Is this the declaration of an enum?
-
isRecord
default boolean isRecord()
Is this the declaration of a record class?
-
isAnnotation
default boolean isAnnotation()
Is this the declaration of an annotation?
-
isReferenceType
default boolean isReferenceType()
Is this the declaration of a reference type?
-
isTypeParameter
default boolean isTypeParameter()
Is this the declaration of a type parameter?
-
isType
default boolean isType()
Description copied from interface:ResolvedDeclarationDoes this declaration represents a type?- Specified by:
isTypein interfaceResolvedDeclaration
-
isAnonymousClass
default boolean isAnonymousClass()
Is this type declaration corresponding to an anonymous class? This is an example of anonymous class:HelloWorld frenchGreeting = new HelloWorld() { String name = "tout le monde"; public void greet() { greetSomeone("tout le monde"); } public void greetSomeone(String someone) { name = someone; System.out.println("Salut " + name); } };
-
asType
default ResolvedTypeDeclaration asType()
Description copied from interface:ResolvedDeclarationReturn this as a TypeDeclaration or throw an UnsupportedOperationException- Specified by:
asTypein interfaceResolvedDeclaration
-
asClass
default ResolvedClassDeclaration asClass()
Return this as a ClassDeclaration or throw UnsupportedOperationException.
-
asInterface
default ResolvedInterfaceDeclaration asInterface()
Return this as a InterfaceDeclaration or throw UnsupportedOperationException.
-
asEnum
default ResolvedEnumDeclaration asEnum()
Return this as a EnumDeclaration or throw UnsupportedOperationException.
-
asRecord
default ResolvedRecordDeclaration asRecord()
Return this as a RecordDeclaration or throw UnsupportedOperationException.
-
asAnnotation
default ResolvedAnnotationDeclaration asAnnotation()
Return this as a AnnotationDeclaration or throw UnsupportedOperationException.
-
asTypeParameter
default ResolvedTypeParameterDeclaration asTypeParameter()
Return this as a TypeParameterDeclaration or throw UnsupportedOperationException.
-
asReferenceType
default ResolvedReferenceTypeDeclaration asReferenceType()
-
getPackageName
String getPackageName()
The package name of the type.
-
getClassName
String getClassName()
The class(es) wrapping this type.
-
getQualifiedName
String getQualifiedName()
The fully qualified name of the type declared.
-
getId
default String getId()
The ID corresponds most of the type to the qualified name. It differs only for local classes which do not have a qualified name but have an ID.
-
-