A Type may be used to represent a run-time type:
Value.type()
or a compile-time type:
Field#type()
Method#returnType()
Method#argumentTypes()
LocalVariable#type()
ArrayType#componentType()
The following tables illustrate which subinterfaces of Type are used to mirror types in the target VM --
| Type declared in target as | Is mirrored as an instance of |
|---|---|
boolean |
BooleanType |
byte |
ByteType |
char |
CharType |
double |
DoubleType |
float |
FloatType |
int |
IntegerType |
long |
LongType |
short |
ShortType |
void |
VoidType |
| Type declared in target as | For example | Is mirrored as an instance of |
|---|---|---|
| a class | Date |
ClassType |
| an interface | Runnable |
InterfaceType |
| an array | (any) | ArrayType |
int[] |
ArrayType whose
componentType() is
IntegerType |
|
Date[] |
ArrayType whose
componentType() is
ClassType |
|
Runnable[] |
ArrayType whose
componentType() is
InterfaceType |
Subinterface PrimitiveType, Subinterface ReferenceType, Value - for relationship between Type and Value, Field.type() - for usage examples
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| public String |
| name | back to summary |
|---|---|
| public String name() Returns the name of this type. The result is of the same form as
the name returned by
| |
| signature | back to summary |
|---|---|
| public String signature() Returns the type signature for this type. The result is of the same
form as the string returned by
| |