public interface Type extends Mirror
Type オブジェクトは、次のような実行時の型を表現する場合に使用できます。
Value
.type()
また、次のようなコンパイル時の型を表現する場合にも使用できます。
Field.type()
Method.returnType()
Method.argumentTypes()
LocalVariable.type()
ArrayType.componentType()
次の表は、ターゲット VM 内の各型をミラーする際に使用される Type のサブインタフェースを示したものです。
PrimitiveType のサブインタフェース |
||
---|---|---|
ターゲット内で宣言される型 | 次のインスタンスとしてミラー化される | |
boolean |
BooleanType |
|
byte |
ByteType |
|
char |
CharType |
|
double |
DoubleType |
|
float |
FloatType |
|
int |
IntegerType |
|
long |
LongType |
|
short |
ShortType |
|
void |
VoidType |
|
ReferenceType のサブインタフェース |
||
ターゲット内で宣言される型 | 例 | 次のインスタンスとしてミラー化される |
クラス | Date |
ClassType |
インタフェース | Runnable |
InterfaceType |
配列 | ArrayType |
|
配列 | int[] |
ArrayType (componentType() が IntegerType ) |
配列 | Date[] |
ArrayType (componentType() が ClassType ) |
配列 | Runnable[] |
ArrayType (componentType() が InterfaceType ) |
サブインタフェース PrimitiveType
, サブインタフェース ReferenceType
, Value - Type と Value 間の関係
, Field.type() - 使用例
String signature()
プリミティブクラスの場合、返されるシグニチャーは対応するプリミティブ型のシグニチャーです。たとえば、「I」は、Integer.TYPE
により表されるクラスのシグニチャーとして返されます。
String name()
Copyright © 1999, 2013, Oracle and/or its affiliates. All rights reserved.