Doclet API

com.sun.javadoc
Interface Type

All Known Subinterfaces:
AnnotationTypeDoc, ClassDoc, ParameterizedType, TypeVariable, WildcardType

public interface Type

Represents a type. A type can be a class or interface, an invocation (like List<String>) of a generic class or interface, a type variable, a wildcard type ("?"), or a primitive data type (like char).

Since:
1.2

Method Summary
 AnnotationTypeDoc asAnnotationTypeDoc()
          Return this type as an AnnotationTypeDoc if it represents an annotation type.
 ClassDoc asClassDoc()
          Return this type as a ClassDoc if it represents a class or interface.
 ParameterizedType asParameterizedType()
          Return this type as a ParameterizedType if it represents an invocation of a generic class or interface.
 TypeVariable asTypeVariable()
          Return this type as a TypeVariable if it represents a type variable.
 WildcardType asWildcardType()
          Return this type as a WildcardType if it represents a wildcard type.
 String dimension()
          Return the type's dimension information, as a string.
 boolean isPrimitive()
          Return true if this type represents a primitive type.
 String qualifiedTypeName()
          Return qualified name of type excluding any dimension information.
 String simpleTypeName()
          Return the simple name of this type excluding any dimension information.
 String toString()
          Return a string representation of the type.
 String typeName()
          Return unqualified name of type excluding any dimension information.
 

Method Detail

typeName

String typeName()
Return unqualified name of type excluding any dimension information.

For example, a two dimensional array of String returns "String".


qualifiedTypeName

String qualifiedTypeName()
Return qualified name of type excluding any dimension information.

For example, a two dimensional array of String returns "java.lang.String".


simpleTypeName

String simpleTypeName()
Return the simple name of this type excluding any dimension information. This is the unqualified name of the type, except that for nested types only the identifier of the innermost type is included.

For example, the class Outer.Inner returns "Inner".

Since:
1.5

dimension

String dimension()
Return the type's dimension information, as a string.

For example, a two dimensional array of String returns "[][]".


toString

String toString()
Return a string representation of the type. This includes any dimension information and type arguments.

For example, a two dimensional array of String may return "java.lang.String[][]", and the parameterized type List<Integer> may return "java.util.List<java.lang.Integer>".

Overrides:
toString in class Object
Returns:
a string representation of the type.

isPrimitive

boolean isPrimitive()
Return true if this type represents a primitive type.

Returns:
true if this type represents a primitive type.
Since:
1.5

asClassDoc

ClassDoc asClassDoc()
Return this type as a ClassDoc if it represents a class or interface. Array dimensions are ignored. If this type is a ParameterizedType, TypeVariable, or WildcardType, return the ClassDoc of the type's erasure. If this is an AnnotationTypeDoc, return this as a ClassDoc (but see asAnnotationTypeDoc()). If this is a primitive type, return null.

Returns:
the ClassDoc of this type, or null if it is a primitive type.

asParameterizedType

ParameterizedType asParameterizedType()
Return this type as a ParameterizedType if it represents an invocation of a generic class or interface. Array dimensions are ignored.

Returns:
a ParameterizedType if the type is an invocation of a generic type, or null if it is not.
Since:
1.5

asTypeVariable

TypeVariable asTypeVariable()
Return this type as a TypeVariable if it represents a type variable. Array dimensions are ignored.

Returns:
a TypeVariable if the type is a type variable, or null if it is not.
Since:
1.5

asWildcardType

WildcardType asWildcardType()
Return this type as a WildcardType if it represents a wildcard type.

Returns:
a WildcardType if the type is a wildcard type, or null if it is not.
Since:
1.5

asAnnotationTypeDoc

AnnotationTypeDoc asAnnotationTypeDoc()
Return this type as an AnnotationTypeDoc if it represents an annotation type. Array dimensions are ignored.

Returns:
an AnnotationTypeDoc if the type is an annotation type, or null if it is not.
Since:
1.5

Doclet API

Submit a bug or feature
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2010, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.