Mirror API

com.sun.mirror.declaration
Interface TypeDeclaration

All Superinterfaces:
Declaration, MemberDeclaration
All Known Subinterfaces:
AnnotationTypeDeclaration, ClassDeclaration, EnumDeclaration, InterfaceDeclaration

public interface TypeDeclaration
extends MemberDeclaration

Represents the declaration of a class or interface. Provides access to information about the type and its members. Note that an enum is a kind of class, and an annotation type is a kind of interface.

While a TypeDeclaration represents the declaration of a class or interface, a DeclaredType represents a class or interface type, the latter being a use (or invocation) of the former. The distinction is most apparent with generic types, for which a single declaration can define a whole family of types. For example, the declaration of java.util.Set corresponds to the parameterized types java.util.Set<String> and java.util.Set<Number> (and many others), and to the raw type java.util.Set.

DeclarationFilter provides a simple way to select just the items of interest when a method returns a collection of declarations.

Since:
1.5
See Also:
DeclaredType

Method Summary
 Collection<FieldDeclaration> getFields()
          Returns the fields that are directly declared by this class or interface.
 Collection<TypeParameterDeclaration> getFormalTypeParameters()
          Returns the formal type parameters of this class or interface.
 Collection<? extends MethodDeclaration> getMethods()
          Returns the methods that are directly declared by this class or interface.
 Collection<TypeDeclaration> getNestedTypes()
          Returns the declarations of the nested classes and interfaces that are directly declared by this class or interface.
 PackageDeclaration getPackage()
          Returns the package within which this type is declared.
 String getQualifiedName()
          Returns the fully qualified name of this class or interface declaration.
 Collection<InterfaceType> getSuperinterfaces()
          Returns the interface types directly implemented by this class or extended by this interface.
 
Methods inherited from interface com.sun.mirror.declaration.MemberDeclaration
getDeclaringType
 
Methods inherited from interface com.sun.mirror.declaration.Declaration
accept, equals, getAnnotation, getAnnotationMirrors, getDocComment, getModifiers, getPosition, getSimpleName
 

Method Detail

getPackage

PackageDeclaration getPackage()
Returns the package within which this type is declared.

Returns:
the package within which this type is declared

getQualifiedName

String getQualifiedName()
Returns the fully qualified name of this class or interface declaration. More precisely, it returns the canonical name. The name of a generic type does not include any reference to its formal type parameters. For example, the the fully qualified name of the interface declaration java.util.Set<E> is "java.util.Set".

Returns:
the fully qualified name of this class or interface declaration

getFormalTypeParameters

Collection<TypeParameterDeclaration> getFormalTypeParameters()
Returns the formal type parameters of this class or interface.

Returns:
the formal type parameters, or an empty collection if there are none

getSuperinterfaces

Collection<InterfaceType> getSuperinterfaces()
Returns the interface types directly implemented by this class or extended by this interface.

Returns:
the interface types directly implemented by this class or extended by this interface, or an empty collection if there are none
See Also:
DeclarationFilter

getFields

Collection<FieldDeclaration> getFields()
Returns the fields that are directly declared by this class or interface. Includes enum constants.

Returns:
the fields that are directly declared, or an empty collection if there are none
See Also:
DeclarationFilter

getMethods

Collection<? extends MethodDeclaration> getMethods()
Returns the methods that are directly declared by this class or interface. Includes annotation type elements. Excludes implicitly declared methods of an interface, such as toString, that correspond to the methods of java.lang.Object.

Returns:
the methods that are directly declared, or an empty collection if there are none
See Also:
DeclarationFilter

getNestedTypes

Collection<TypeDeclaration> getNestedTypes()
Returns the declarations of the nested classes and interfaces that are directly declared by this class or interface.

Returns:
the declarations of the nested classes and interfaces, or an empty collection if there are none
See Also:
DeclarationFilter

Mirror API

Report a bug or request a feature.
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms.