public interface Type
List<String>
) of a generic class or interface,
a type variable, a wildcard type ("?
"),
or a primitive data type (like char
).Modifier and Type | Method and Description |
---|---|
AnnotatedType |
asAnnotatedType()
Returns this type as a
AnnotatedType if it represents
an annotated type. |
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.
|
Type |
getElementType()
If this type is an array type, return the element type of the
array.
|
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.
|
String typeName()
For example, a two dimensional array of String returns
"String
".
String qualifiedTypeName()
For example, a two dimensional array of String
returns "java.lang.String
".
String simpleTypeName()
For example, the class Outer.Inner
returns
"Inner
".
String dimension()
For example, a two dimensional array of String returns
"[][]
".
String toString()
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>
".
boolean isPrimitive()
ClassDoc asClassDoc()
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.ClassDoc
of this type,
or null if it is a primitive type.ParameterizedType asParameterizedType()
ParameterizedType
if it represents
an invocation of a generic class or interface. Array dimensions
are ignored.ParameterizedType
if the type is an
invocation of a generic type, or null if it is not.TypeVariable asTypeVariable()
TypeVariable
if it represents
a type variable. Array dimensions are ignored.TypeVariable
if the type is a type variable,
or null if it is not.WildcardType asWildcardType()
WildcardType
if it represents
a wildcard type.WildcardType
if the type is a wildcard type,
or null if it is not.AnnotatedType asAnnotatedType()
AnnotatedType
if it represents
an annotated type.AnnotatedType
if the type if an annotated type,
or null if it is notAnnotationTypeDoc asAnnotationTypeDoc()
AnnotationTypeDoc
if it represents
an annotation type. Array dimensions are ignored.AnnotationTypeDoc
if the type is an annotation
type, or null if it is not.Type getElementType()
Type
representing the element type or null. 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, 2015, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.