Package com.thoughtworks.paranamer
Class BytecodeReadingParanamer.Type
java.lang.Object
com.thoughtworks.paranamer.BytecodeReadingParanamer.Type
- Enclosing class:
- BytecodeReadingParanamer
A Java type. This class can be used to make it easier to manipulate type and
method descriptors.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
The sort of array reference types.private static final int
The sort of the boolean type.private static final BytecodeReadingParanamer.Type
The boolean type.private char[]
A buffer containing the internal name of this Java type.private static final int
The sort of the byte type.private static final BytecodeReadingParanamer.Type
The byte type.private static final int
The sort of the char type.private static final BytecodeReadingParanamer.Type
The char type.private static final int
The sort of the double type.private static final BytecodeReadingParanamer.Type
The double type.private static final int
The sort of the float type.private static final BytecodeReadingParanamer.Type
The float type.private static final int
The sort of the int type.private static final BytecodeReadingParanamer.Type
The int type.private final int
The length of the internal name of this Java type.private static final int
The sort of the long type.private static final BytecodeReadingParanamer.Type
The long type.private static final int
The sort of object reference type.private int
The offset of the internal name of this Java type inbuf
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).private static final int
The sort of the short type.private static final BytecodeReadingParanamer.Type
The short type.private final int
The sort of this Java type.private static final int
The sort of the void type.private static final BytecodeReadingParanamer.Type
The void type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static BytecodeReadingParanamer.Type[]
getArgumentTypes
(String methodDescriptor) Returns the Java types corresponding to the argument types of the given method descriptor.private String
Returns the name of the class corresponding to this type.private int
Returns the number of dimensions of this array type.private BytecodeReadingParanamer.Type
Returns the type of the elements of this array type.private static BytecodeReadingParanamer.Type
getType
(char[] buf, int off) Returns the Java type corresponding to the given type descriptor.
-
Field Details
-
VOID
private static final int VOIDThe sort of the void type.- See Also:
-
BOOLEAN
private static final int BOOLEANThe sort of the boolean type.- See Also:
-
CHAR
private static final int CHARThe sort of the char type.- See Also:
-
BYTE
private static final int BYTEThe sort of the byte type.- See Also:
-
SHORT
private static final int SHORTThe sort of the short type.- See Also:
-
INT
private static final int INTThe sort of the int type.- See Also:
-
FLOAT
private static final int FLOATThe sort of the float type.- See Also:
-
LONG
private static final int LONGThe sort of the long type.- See Also:
-
DOUBLE
private static final int DOUBLEThe sort of the double type.- See Also:
-
ARRAY
private static final int ARRAYThe sort of array reference types.- See Also:
-
OBJECT
private static final int OBJECTThe sort of object reference type.- See Also:
-
VOID_TYPE
The void type. -
BOOLEAN_TYPE
The boolean type. -
CHAR_TYPE
The char type. -
BYTE_TYPE
The byte type. -
SHORT_TYPE
The short type. -
INT_TYPE
The int type. -
FLOAT_TYPE
The float type. -
LONG_TYPE
The long type. -
DOUBLE_TYPE
The double type. -
sort
private final int sortThe sort of this Java type. -
buf
private char[] bufA buffer containing the internal name of this Java type. This field is only used for reference types. -
off
private int offThe offset of the internal name of this Java type inbuf
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). -
len
private final int lenThe length of the internal name of this Java type.
-
-
Constructor Details
-
Type
private Type(int sort) Constructs a primitive type.- Parameters:
sort
- the sort of the primitive type to be constructed.
-
Type
private Type(int sort, char[] buf, int off, int len) Constructs a reference type.- Parameters:
sort
- the sort of the reference type to be constructed.buf
- a buffer containing the descriptor of the previous type.off
- the offset of this descriptor in the previous buffer.len
- the length of this descriptor.
-
-
Method Details
-
getArgumentTypes
Returns the Java types corresponding to the argument types of the given method descriptor.- Parameters:
methodDescriptor
- a method descriptor.- Returns:
- the Java types corresponding to the argument types of the given method descriptor.
-
getType
Returns the Java type corresponding to the given type descriptor.- Parameters:
buf
- a buffer containing a type descriptor.off
- the offset of this descriptor in the previous buffer.- Returns:
- the Java type corresponding to the given type descriptor.
-
getDimensions
private int getDimensions()Returns the number of dimensions of this array type. This method should only be used for an array type.- Returns:
- the number of dimensions of this array type.
-
getElementType
Returns the type of the elements of this array type. This method should only be used for an array type.- Returns:
- Returns the type of the elements of this array type.
-
getClassName
Returns the name of the class corresponding to this type.- Returns:
- the fully qualified name of the class corresponding to this type.
-