Interface ResolvedTypeDeclaration
- All Superinterfaces:
ResolvedDeclaration
- All Known Subinterfaces:
ResolvedAnnotationDeclaration
,ResolvedClassDeclaration
,ResolvedEnumDeclaration
,ResolvedInterfaceDeclaration
,ResolvedReferenceTypeDeclaration
,ResolvedTypeParameterDeclaration
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
Modifier and TypeMethodDescriptiondefault ResolvedAnnotationDeclaration
Return this as a AnnotationDeclaration or throw UnsupportedOperationException.default ResolvedClassDeclaration
asClass()
Return this as a ClassDeclaration or throw UnsupportedOperationException.default ResolvedEnumDeclaration
asEnum()
Return this as a EnumDeclaration or throw UnsupportedOperationException.default ResolvedInterfaceDeclaration
Return this as a InterfaceDeclaration or throw UnsupportedOperationException.default ResolvedReferenceTypeDeclaration
default ResolvedTypeDeclaration
asType()
Return this as a TypeDeclaration or throw an UnsupportedOperationExceptiondefault ResolvedTypeParameterDeclaration
Return this as a TypeParameterDeclaration or throw UnsupportedOperationException.Get the ReferenceTypeDeclaration enclosing this declaration.The class(es) wrapping this type.default String
getId()
The ID corresponds most of the type to the qualified name.default ResolvedReferenceTypeDeclaration
getInternalType(String name)
Returns a type declaration for the internal type based on name.The package name of the type.The fully qualified name of the type declared.default boolean
hasInternalType(String name)
Does this type contain an internal type with the given name? (Does not include internal types inside internal types).default Set<ResolvedReferenceTypeDeclaration>
Get the list of types defined inside the current type.default boolean
Is this the declaration of an annotation?default boolean
Is this type declaration corresponding to an anonymous class? This is an example of anonymous class:default boolean
isClass()
Is this the declaration of a class? Note that an Enum is not considered a Class in this case.default boolean
isEnum()
Is this the declaration of an enum?default boolean
Is this the declaration of an interface?default boolean
isType()
Does this declaration represents a type?default boolean
Is this the declaration of a type parameter?Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedDeclaration
asEnumConstant, asField, asMethod, asParameter, asPattern, getName, hasName, isEnumConstant, isField, isMethod, isParameter, isPattern, isVariable
-
Method Details
-
internalTypes
Get the list of types defined inside the current type. -
getInternalType
Returns a type declaration for the internal type based on name. (Does not include internal types inside internal types). -
hasInternalType
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? -
isAnnotation
default boolean isAnnotation()Is this the declaration of an annotation? -
isTypeParameter
default boolean isTypeParameter()Is this the declaration of a type parameter? -
isType
default boolean isType()Description copied from interface:ResolvedDeclaration
Does this declaration represents a type?- Specified by:
isType
in 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
Description copied from interface:ResolvedDeclaration
Return this as a TypeDeclaration or throw an UnsupportedOperationException- Specified by:
asType
in interfaceResolvedDeclaration
-
asClass
Return this as a ClassDeclaration or throw UnsupportedOperationException. -
asInterface
Return this as a InterfaceDeclaration or throw UnsupportedOperationException. -
asEnum
Return this as a EnumDeclaration or throw UnsupportedOperationException. -
asAnnotation
Return this as a AnnotationDeclaration or throw UnsupportedOperationException. -
asTypeParameter
Return this as a TypeParameterDeclaration or throw UnsupportedOperationException. -
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
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.
-