Skip to content

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

ts
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 private

ts
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 private

ts
len: number

The length of the internal name of this Java type.

Defined in: packages/asm/libs/Type.ts:174

off private

ts
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 readonly

ts
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 static readonly

ts
ARRAY: number = 9

The sort of array reference types. See #getSort getSort.

Defined in: packages/asm/libs/Type.ts:89

BOOLEAN static readonly

ts
BOOLEAN: number = 1

The sort of the <tt>boolean</tt> type. See #getSort getSort.

Defined in: packages/asm/libs/Type.ts:49

BOOLEAN_TYPE static readonly

ts
BOOLEAN_TYPE: Type = ...

The <tt>boolean</tt> type.

Defined in: packages/asm/libs/Type.ts:109

BYTE static readonly

ts
BYTE: number = 3

The sort of the <tt>byte</tt> type. See #getSort getSort.

Defined in: packages/asm/libs/Type.ts:59

BYTE_TYPE static readonly

ts
BYTE_TYPE: Type = ...

The <tt>byte</tt> type.

Defined in: packages/asm/libs/Type.ts:119

CHAR static readonly

ts
CHAR: number = 2

The sort of the <tt>char</tt> type. See #getSort getSort.

Defined in: packages/asm/libs/Type.ts:54

CHAR_TYPE static readonly

ts
CHAR_TYPE: Type = ...

The <tt>char</tt> type.

Defined in: packages/asm/libs/Type.ts:114

DOUBLE static readonly

ts
DOUBLE: number = 8

The sort of the <tt>double</tt> type. See #getSort getSort.

Defined in: packages/asm/libs/Type.ts:84

DOUBLE_TYPE static readonly

ts
DOUBLE_TYPE: Type = ...

The <tt>double</tt> type.

Defined in: packages/asm/libs/Type.ts:144

FLOAT static readonly

ts
FLOAT: number = 6

The sort of the <tt>float</tt> type. See #getSort getSort.

Defined in: packages/asm/libs/Type.ts:74

FLOAT_TYPE static readonly

ts
FLOAT_TYPE: Type = ...

The <tt>float</tt> type.

Defined in: packages/asm/libs/Type.ts:134

INT static readonly

ts
INT: number = 5

The sort of the <tt>int</tt> type. See #getSort getSort.

Defined in: packages/asm/libs/Type.ts:69

INT_TYPE static readonly

ts
INT_TYPE: Type = ...

The <tt>int</tt> type.

Defined in: packages/asm/libs/Type.ts:129

LONG static readonly

ts
LONG: number = 7

The sort of the <tt>long</tt> type. See #getSort getSort.

Defined in: packages/asm/libs/Type.ts:79

LONG_TYPE static readonly

ts
LONG_TYPE: Type = ...

The <tt>long</tt> type.

Defined in: packages/asm/libs/Type.ts:139

METHOD static readonly

ts
METHOD: number = 11

The sort of method types. See #getSort getSort.

Defined in: packages/asm/libs/Type.ts:99

OBJECT static readonly

ts
OBJECT: number = 10

The sort of object reference types. See #getSort getSort.

Defined in: packages/asm/libs/Type.ts:94

SHORT static readonly

ts
SHORT: number = 4

The sort of the <tt>short</tt> type. See #getSort getSort.

Defined in: packages/asm/libs/Type.ts:64

SHORT_TYPE static readonly

ts
SHORT_TYPE: Type = ...

The <tt>short</tt> type.

Defined in: packages/asm/libs/Type.ts:124

VOID static readonly

ts
VOID: number = 0

The sort of the <tt>void</tt> type. See #getSort getSort.

Defined in: packages/asm/libs/Type.ts:44

VOID_TYPE static readonly

ts
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

ts
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

ts
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

ts
hashCode(): number

Returns a hash code value for this type.

Return Type

  • number

Defined in: packages/asm/libs/Type.ts:421

toString

ts
toString(): string

Returns a string representation of this type.

Return Type

  • string

Defined in: packages/asm/libs/Type.ts:436

getArgumentTypes static

ts
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 static

ts
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 static

ts
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 static

ts
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 static

ts
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