Class Type
A Java field or method type. This class can be used to make it easier to manipulate type and method descriptors.
🏭 Constructors
constructor
new Type(sort: number, buf: null | string, off: number, len: number): Type
Constructs a reference type.
Parameters
- sort:
number
the sort of the reference type to be constructed. - buf:
null | string
a buffer containing the descriptor of the previous type. - off:
number
the offset of this descriptor in the previous buffer. - len:
number
the length of this descriptor.
Return Type
Type
Defined in: packages/asm/libs/Type.ts:184
🏷️ Properties
buf
buf: string
A buffer containing the internal name of this Java type. This field is only used for reference types.
Defined in: packages/asm/libs/Type.ts:161
len
len: number
The length of the internal name of this Java type.
Defined in: packages/asm/libs/Type.ts:174
off
off: number
The offset of the internal name of this Java type in #buf buf or, for primitive types, the size, descriptor and getOpcode offsets for this type (byte 0 contains the size, byte 1 the descriptor, byte 2 the offset for IALOAD or IASTORE, byte 3 the offset for all other instructions).
Defined in: packages/asm/libs/Type.ts:169
sort
sort: number
The sort of this Java type.
#VOID VOID, #BOOLEAN BOOLEAN, #CHAR CHAR, #BYTE BYTE, #SHORT SHORT, #INT INT, #FLOAT FLOAT, #LONG LONG, #DOUBLE DOUBLE, #ARRAY ARRAY, #OBJECT OBJECT or #METHOD METHOD.
Defined in: packages/asm/libs/Type.ts:155
ARRAY
ARRAY: number = 9
The sort of array reference types. See #getSort getSort.
Defined in: packages/asm/libs/Type.ts:89
BOOLEAN
BOOLEAN: number = 1
The sort of the <tt>boolean</tt> type. See #getSort getSort.
Defined in: packages/asm/libs/Type.ts:49
BOOLEAN_TYPE
BOOLEAN_TYPE: Type = ...
The <tt>boolean</tt> type.
Defined in: packages/asm/libs/Type.ts:109
BYTE
BYTE: number = 3
The sort of the <tt>byte</tt> type. See #getSort getSort.
Defined in: packages/asm/libs/Type.ts:59
BYTE_TYPE
BYTE_TYPE: Type = ...
The <tt>byte</tt> type.
Defined in: packages/asm/libs/Type.ts:119
CHAR
CHAR: number = 2
The sort of the <tt>char</tt> type. See #getSort getSort.
Defined in: packages/asm/libs/Type.ts:54
CHAR_TYPE
CHAR_TYPE: Type = ...
The <tt>char</tt> type.
Defined in: packages/asm/libs/Type.ts:114
DOUBLE
DOUBLE: number = 8
The sort of the <tt>double</tt> type. See #getSort getSort.
Defined in: packages/asm/libs/Type.ts:84
DOUBLE_TYPE
DOUBLE_TYPE: Type = ...
The <tt>double</tt> type.
Defined in: packages/asm/libs/Type.ts:144
FLOAT
FLOAT: number = 6
The sort of the <tt>float</tt> type. See #getSort getSort.
Defined in: packages/asm/libs/Type.ts:74
FLOAT_TYPE
FLOAT_TYPE: Type = ...
The <tt>float</tt> type.
Defined in: packages/asm/libs/Type.ts:134
INT
INT: number = 5
The sort of the <tt>int</tt> type. See #getSort getSort.
Defined in: packages/asm/libs/Type.ts:69
INT_TYPE
INT_TYPE: Type = ...
The <tt>int</tt> type.
Defined in: packages/asm/libs/Type.ts:129
LONG
LONG: number = 7
The sort of the <tt>long</tt> type. See #getSort getSort.
Defined in: packages/asm/libs/Type.ts:79
LONG_TYPE
LONG_TYPE: Type = ...
The <tt>long</tt> type.
Defined in: packages/asm/libs/Type.ts:139
METHOD
METHOD: number = 11
The sort of method types. See #getSort getSort.
Defined in: packages/asm/libs/Type.ts:99
OBJECT
OBJECT: number = 10
The sort of object reference types. See #getSort getSort.
Defined in: packages/asm/libs/Type.ts:94
SHORT
SHORT: number = 4
The sort of the <tt>short</tt> type. See #getSort getSort.
Defined in: packages/asm/libs/Type.ts:64
SHORT_TYPE
SHORT_TYPE: Type = ...
The <tt>short</tt> type.
Defined in: packages/asm/libs/Type.ts:124
VOID
VOID: number = 0
The sort of the <tt>void</tt> type. See #getSort getSort.
Defined in: packages/asm/libs/Type.ts:44
VOID_TYPE
VOID_TYPE: Type = ...
The <tt>void</tt> type.
Defined in: packages/asm/libs/Type.ts:104
🔑 Accessors
internalName
Defined in: packages/asm/libs/Type.ts:349
size
Defined in: packages/asm/libs/Type.ts:382
🔧 Methods
equals
equals(o: any): boolean
Tests if the given object is equal to this type.
Parameters
- o:
any
the object to be compared to this type.
Return Type
boolean
Defined in: packages/asm/libs/Type.ts:392
getDescriptor
getDescriptor(buf: any= ''): any
Appends the descriptor corresponding to this Java type to the given string buffer.
Parameters
- buf:
any
the string buffer to which the descriptor must be appended.
Return Type
any
Defined in: packages/asm/libs/Type.ts:359
hashCode
hashCode(): number
Returns a hash code value for this type.
Return Type
number
Defined in: packages/asm/libs/Type.ts:421
toString
toString(): string
Returns a string representation of this type.
Return Type
string
Defined in: packages/asm/libs/Type.ts:436
getArgumentTypes
getArgumentTypes(methodDescriptor: string): Type[]
Returns the Java types corresponding to the argument types of the given method descriptor.
Parameters
- methodDescriptor:
string
a method descriptor.
Return Type
Type[]
Defined in: packages/asm/libs/Type.ts:223
getArgumentsAndReturnSizes
getArgumentsAndReturnSizes(desc: string): number
Computes the size of the arguments and of the return value of a method.
Parameters
- desc:
string
the descriptor of a method.
Return Type
number
Defined in: packages/asm/libs/Type.ts:259
getMethodType
getMethodType(methodDescriptor: string): Type
Returns the Java type corresponding to the given method descriptor. Equivalent to <code>Type.getType(methodDescriptor)</code>.
Parameters
- methodDescriptor:
string
a method descriptor.
Return Type
Type
Defined in: packages/asm/libs/Type.ts:211
getObjectType
getObjectType(internalName: string): Type
Returns the Java type corresponding to the given internal name.
Parameters
- internalName:
string
an internal name.
Return Type
Type
Defined in: packages/asm/libs/Type.ts:200
getType
getType(str: string, off: number= 0): Type
Returns the Java type corresponding to the given type descriptor. For method descriptors, buf is supposed to contain nothing more than the descriptor itself.
Parameters
- str:
string
- off:
number
the offset of this descriptor in the previous buffer.
Return Type
Type
Defined in: packages/asm/libs/Type.ts:296