public enum Kind extends Enum<Kind> implements PlatformKind
Modifier and Type | Class and Description |
---|---|
static interface |
Kind.FormatWithToString
Marker interface for types that should be formatted with
their
Object.toString() value. |
PlatformKind.EnumKey, PlatformKind.Key
Enum Constant and Description |
---|
Boolean
The primitive boolean kind, represented as an int on the stack.
|
Byte
The primitive byte kind, represented as an int on the stack.
|
Char
The primitive char kind, represented as an int on the stack.
|
Double
The primitive double kind.
|
Float
The primitive float kind.
|
Illegal
The non-type.
|
Int
The primitive int kind, represented as an int on the stack.
|
Long
The primitive long kind.
|
Object
The Object kind, also used for arrays.
|
Short
The primitive short kind, represented as an int on the stack.
|
Void
The void float kind.
|
Modifier and Type | Field and Description |
---|---|
private Class<?> |
boxedJavaClass |
private boolean |
isStackInt |
private String |
javaName |
private PlatformKind.EnumKey |
key |
private static int |
MAX_FORMAT_ARRAY_LENGTH |
private Class<?> |
primitiveJavaClass |
private int |
slotCount |
private char |
typeChar |
Modifier and Type | Method and Description |
---|---|
String |
format(Object value)
Gets a formatted string for a given value of this kind.
|
private static String |
formatArray(Object array) |
static Kind |
fromJavaClass(Class<?> klass)
Returns the Kind representing the given Java class.
|
static Kind |
fromPrimitiveOrVoidTypeChar(char ch)
Returns the kind from the character describing a primitive or void.
|
static Kind |
fromTypeString(String typeString)
Returns the kind corresponding to the Java type string.
|
static Kind |
fromWordSize(int wordSizeInBytes)
Returns the kind of a word given the size of a word in bytes.
|
int |
getBitCount()
Number of bits that are necessary to represent a value of this kind.
|
int |
getByteCount()
Number of bytes that are necessary to represent a value of this kind.
|
JavaConstant |
getDefaultValue() |
String |
getJavaName()
Returns the name of this kind which will also be it Java programming language name if it is
primitive or
void . |
PlatformKind.Key |
getKey()
Gets a value associated with this object that can be used as a stable key in a map.
|
long |
getMaxValue()
The maximum value that can be represented as a value of this kind.
|
long |
getMinValue()
The minimum value that can be represented as a value of this kind.
|
int |
getSlotCount()
Returns the number of stack slots occupied by this kind according to the Java bytecodes
specification.
|
Kind |
getStackKind()
Returns the kind that represents this kind when on the Java operand stack.
|
char |
getTypeChar()
Returns the name of the kind as a single character.
|
boolean |
isNumericFloat()
Checks whether this type is a Java primitive type representing a floating point number.
|
boolean |
isNumericInteger()
Checks whether this type is a Java primitive type representing an integer number.
|
boolean |
isObject()
Checks whether this represent an Object of some sort.
|
boolean |
isPrimitive()
Checks whether this type is a Java primitive type.
|
private static boolean |
isToStringSafe(Class<?> c)
Classes for which invoking
Object.toString() does not run user code. |
boolean |
isUnsigned()
Checks whether this type is a Java primitive type representing an unsigned number.
|
boolean |
needsTwoSlots()
Returns whether this kind occupied two stack slots.
|
Class<?> |
toBoxedJavaClass()
Returns the Java class for instances of boxed values of this kind.
|
Class<?> |
toJavaClass()
Returns the Java class representing this kind.
|
String |
toString()
Converts this value type to a string.
|
static Kind |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Kind[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
getVectorLength, name
public static final Kind Boolean
private final char typeChar
private final boolean isStackInt
private final Class<?> primitiveJavaClass
private final Class<?> boxedJavaClass
private final PlatformKind.EnumKey key
private final int slotCount
private static final int MAX_FORMAT_ARRAY_LENGTH
public static Kind[] values()
for (Kind c : Kind.values()) System.out.println(c);
public static Kind valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic int getSlotCount()
public boolean needsTwoSlots()
public char getTypeChar()
public String getJavaName()
void
.public PlatformKind.Key getKey()
PlatformKind
Object.hashCode()
implementation of the returned value should be stable between VM
executions.getKey
in interface PlatformKind
public boolean isPrimitive()
public Kind getStackKind()
public boolean isNumericInteger()
public boolean isUnsigned()
public boolean isNumericFloat()
public boolean isObject()
true
if this is Object
.public static Kind fromTypeString(String typeString)
typeString
- the Java type stringpublic static Kind fromWordSize(int wordSizeInBytes)
wordSizeInBytes
- the size of a word in bytespublic static Kind fromPrimitiveOrVoidTypeChar(char ch)
ch
- the characterpublic static Kind fromJavaClass(Class<?> klass)
klass
- the classpublic Class<?> toJavaClass()
public Class<?> toBoxedJavaClass()
private static boolean isToStringSafe(Class<?> c)
Object.toString()
does not run user code.public String format(Object value)
value
- a value of this kindvalue
based on this kindprivate static String formatArray(Object array)
public long getMinValue()
public long getMaxValue()
public int getByteCount()
public int getBitCount()
public JavaConstant getDefaultValue()
getDefaultValue
in interface PlatformKind