Top Description Methods
com.github.javaparser.resolution.declarations

public Interface ResolvedTypeDeclaration

extends ResolvedDeclaration
Known Direct Subinterfaces
com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration, com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
Imports
com.github.javaparser.resolution.UnsolvedSymbolException, java.util.Optional, .Set

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 TypeMethod and Description
public default ResolvedClassDeclaration
asClass()

Return this as a ClassDeclaration or throw UnsupportedOperationException.

public default ResolvedEnumDeclaration
asEnum()

Return this as a EnumDeclaration or throw UnsupportedOperationException.

public default ResolvedInterfaceDeclaration
asInterface()

Return this as a InterfaceDeclaration or throw UnsupportedOperationException.

public default ResolvedReferenceTypeDeclaration
public default ResolvedTypeDeclaration
asType()

Overrides default com.github.javaparser.resolution.declarations.ResolvedDeclaration.asType.

Return this as a TypeDeclaration or throw an UnsupportedOperationException
public default ResolvedTypeParameterDeclaration
asTypeParameter()

Return this as a TypeParameterDeclaration or throw UnsupportedOperationException.

public Optional<ResolvedReferenceTypeDeclaration>
containerType()

Get the ReferenceTypeDeclaration enclosing this declaration.

public String
getClassName()

The class(es) wrapping this type.

public default String
getId()

The ID corresponds most of the type to the qualified name.

public default ResolvedReferenceTypeDeclaration
getInternalType(String name)

Returns a type declaration for the internal type based on name.

public String
getPackageName()

The package name of the type.

public String
getQualifiedName()

The fully qualified name of the type declared.

public default boolean
hasInternalType(String name)

Does this type contain an internal type with the given name?

public default Set<ResolvedReferenceTypeDeclaration>
internalTypes()

Get the list of types defined inside the current type.

public default boolean
isAnonymousClass()

Is this type declaration corresponding to an anonymous class?

public default boolean
isClass()

Is this the declaration of a class?

public default boolean
isEnum()

Is this the declaration of an enum?

public default boolean
isInterface()

Is this the declaration of an interface?

public default boolean
isType()

Overrides default com.github.javaparser.resolution.declarations.ResolvedDeclaration.isType.

Does this declaration represents a type?
public default boolean
isTypeParameter()

Is this the declaration of a type parameter?

Inherited from com.github.javaparser.resolution.declarations.ResolvedDeclaration:
asEnumConstantasFieldasMethodasParametergetNamehasNameisEnumConstantisFieldisMethodisParameterisVariable

Method Detail

asClassback to summary
public default ResolvedClassDeclaration asClass()

Return this as a ClassDeclaration or throw UnsupportedOperationException.

asEnumback to summary
public default ResolvedEnumDeclaration asEnum()

Return this as a EnumDeclaration or throw UnsupportedOperationException.

asInterfaceback to summary
public default ResolvedInterfaceDeclaration asInterface()

Return this as a InterfaceDeclaration or throw UnsupportedOperationException.

asReferenceTypeback to summary
public default ResolvedReferenceTypeDeclaration asReferenceType()
asTypeback to summary
public default ResolvedTypeDeclaration asType()

Overrides default com.github.javaparser.resolution.declarations.ResolvedDeclaration.asType.

Doc from com.github.javaparser.resolution.declarations.ResolvedDeclaration.asType.

Return this as a TypeDeclaration or throw an UnsupportedOperationException

Annotations
@Override
asTypeParameterback to summary
public default ResolvedTypeParameterDeclaration asTypeParameter()

Return this as a TypeParameterDeclaration or throw UnsupportedOperationException.

containerTypeback to summary
public Optional<ResolvedReferenceTypeDeclaration> containerType()

Get the ReferenceTypeDeclaration enclosing this declaration.

getClassNameback to summary
public String getClassName()

The class(es) wrapping this type.

getIdback to summary
public 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.

getInternalTypeback to summary
public default ResolvedReferenceTypeDeclaration getInternalType(String name)

Returns a type declaration for the internal type based on name. (Does not include internal types inside internal types).

getPackageNameback to summary
public String getPackageName()

The package name of the type.

getQualifiedNameback to summary
public String getQualifiedName()

The fully qualified name of the type declared.

hasInternalTypeback to summary
public default boolean hasInternalType(String name)

Does this type contain an internal type with the given name? (Does not include internal types inside internal types).

internalTypesback to summary
public default Set<ResolvedReferenceTypeDeclaration> internalTypes()

Get the list of types defined inside the current type.

isAnonymousClassback to summary
public 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);
    }
};
isClassback to summary
public default boolean isClass()

Is this the declaration of a class? Note that an Enum is not considered a Class in this case.

isEnumback to summary
public default boolean isEnum()

Is this the declaration of an enum?

isInterfaceback to summary
public default boolean isInterface()

Is this the declaration of an interface?

isTypeback to summary
public default boolean isType()

Overrides default com.github.javaparser.resolution.declarations.ResolvedDeclaration.isType.

Doc from com.github.javaparser.resolution.declarations.ResolvedDeclaration.isType.

Does this declaration represents a type?

Annotations
@Override
isTypeParameterback to summary
public default boolean isTypeParameter()

Is this the declaration of a type parameter?