public interface TypeDeclaration extends Declaration, TypeParametrizable
| Modifier and Type | Method and Description |
|---|---|
default ClassDeclaration |
asClass()
Return this as a ClassDeclaration or throw UnsupportedOperationException.
|
default EnumDeclaration |
asEnum()
Return this as a EnumDeclaration or throw UnsupportedOperationException.
|
default InterfaceDeclaration |
asInterface()
Return this as a InterfaceDeclaration or throw UnsupportedOperationException.
|
default TypeDeclaration |
asType()
Return this as a TypeDeclaration or throw an UnsupportedOperationException
|
default TypeParameterDeclaration |
asTypeParameter()
Return this as a TypeParameterDeclaration or throw UnsupportedOperationException.
|
default boolean |
canBeAssignedTo(TypeDeclaration other)
Can we assign instances of the type defined by this declaration to variables having the type defined
by the given type?
|
default Optional<TypeDeclaration> |
containerType()
Get the TypeDeclaration enclosing this declaration.
|
default Optional<TypeParameterDeclaration> |
findTypeParameter(String name)
Find the closest TypeParameterDeclaration with the given name.
|
default List<ReferenceType> |
getAllAncestors()
The list of all the ancestors of the current declaration, direct and indirect.
|
List<FieldDeclaration> |
getAllFields()
Return a list of all fields, either declared in this declaration or inherited.
|
Set<MethodUsage> |
getAllMethods()
Return a list of all the methods declared of this type declaration, either declared or inherited.
|
default List<FieldDeclaration> |
getAllNonStaticFields()
Return a list of all the non static fields, either declared or inherited.
|
default List<FieldDeclaration> |
getAllStaticFields()
Return a list of all the static fields, either declared or inherited.
|
List<ReferenceType> |
getAncestors()
The list of all the direct ancestors of the current declaration.
|
default List<FieldDeclaration> |
getDeclaredFields()
Return a list of all the fields declared in this type.
|
Set<MethodDeclaration> |
getDeclaredMethods()
Return a list of all the methods declared in this type declaration.
|
FieldDeclaration |
getField(String name)
Note that the type of the field should be expressed using the type variables of this particular type.
|
default String |
getId()
The ID corresponds most of the type to the qualified name.
|
String |
getQualifiedName()
The fully qualified name of the type declared.
|
default boolean |
hasAnnotation(String qualifiedName)
Has the type at least one annotation declared or inherited having the specified qualified name?
|
boolean |
hasDirectlyAnnotation(String qualifiedName)
Has the type at least one annotation declared having the specified qualified name?
|
boolean |
hasField(String name)
Has this type a field with the given name?
|
default Set<TypeDeclaration> |
internalTypes()
Get the list of types defined inside the current type.
|
boolean |
isAssignableBy(Type type)
Can we assign instances of the given type to variables having the type defined
by this declaration?
|
boolean |
isAssignableBy(TypeDeclaration other)
Can we assign instances of the given type to variables having the type defined
by this declaration?
|
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 |
isInterface()
Is this the declaration of an interface?
|
default boolean |
isType()
Does this declaration represents a type?
|
default boolean |
isTypeParameter()
Is this the declaration of a type parameter?
|
asField, asMethod, asParameter, getName, hasName, isField, isMethod, isParametergetTypeParametersdefault Set<TypeDeclaration> internalTypes()
default Optional<TypeDeclaration> containerType()
default boolean isClass()
default boolean isInterface()
default boolean isEnum()
default boolean isTypeParameter()
default boolean isType()
DeclarationisType in interface Declarationdefault TypeDeclaration asType()
DeclarationasType in interface Declarationdefault ClassDeclaration asClass()
default InterfaceDeclaration asInterface()
default EnumDeclaration asEnum()
default TypeParameterDeclaration asTypeParameter()
String getQualifiedName()
default String getId()
default Optional<TypeParameterDeclaration> findTypeParameter(String name)
TypeParametrizablefindTypeParameter in interface TypeParametrizableList<ReferenceType> getAncestors()
class A implements Comparable<String> {}
In this case the ancestor is Comparable<String>
default List<ReferenceType> getAllAncestors()
FieldDeclaration getField(String name)
class Foo
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.
boolean hasField(String name)
List<FieldDeclaration> getAllFields()
default List<FieldDeclaration> getAllNonStaticFields()
default List<FieldDeclaration> getAllStaticFields()
default List<FieldDeclaration> getDeclaredFields()
Set<MethodDeclaration> getDeclaredMethods()
Set<MethodUsage> getAllMethods()
boolean isAssignableBy(Type type)
default boolean canBeAssignedTo(TypeDeclaration other)
boolean isAssignableBy(TypeDeclaration other)
boolean hasDirectlyAnnotation(String qualifiedName)
default boolean hasAnnotation(String qualifiedName)
Copyright © 2016. All rights reserved.