Package org.ehcache.sizeof.impl
Enum PrimitiveType
- All Implemented Interfaces:
Serializable
,Comparable<PrimitiveType>
,java.lang.constant.Constable
Primitive types in the VM type system and their sizes
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PrimitiveType
Finds the matching PrimitiveType for a typestatic long
The size on an arraystatic int
The size of a pointerint
getSize()
Returns the size in memory this type occupiesClass
<?> getType()
The representing typestatic PrimitiveType
Returns the enum constant of this type with the specified name.static PrimitiveType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
BOOLEAN
boolean.class -
BYTE
byte.class -
CHAR
char.class -
SHORT
short.class -
INT
int.class -
FLOAT
float.class -
DOUBLE
double.class -
LONG
long.class
-
-
Field Details
-
type
-
size
private final int size
-
-
Constructor Details
-
PrimitiveType
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getSize
public int getSize()Returns the size in memory this type occupies- Returns:
- size in bytes
-
getType
The representing type- Returns:
- the type
-
getReferenceSize
public static int getReferenceSize()The size of a pointer- Returns:
- size in bytes
-
getArraySize
public static long getArraySize()The size on an array- Returns:
- size in bytes
-
forType
Finds the matching PrimitiveType for a type- Parameters:
type
- the type to find the PrimitiveType for- Returns:
- the PrimitiveType instance or null if none found
-