Package org.ehcache.sizeof.impl
Enum PrimitiveType
- java.lang.Object
-
- java.lang.Enum<PrimitiveType>
-
- org.ehcache.sizeof.impl.PrimitiveType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<PrimitiveType>
enum PrimitiveType extends java.lang.Enum<PrimitiveType>
Primitive types in the VM type system and their sizes
-
-
Constructor Summary
Constructors Modifier Constructor Description private
PrimitiveType(java.lang.Class<?> type, int size)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PrimitiveType
forType(java.lang.Class<?> type)
Finds the matching PrimitiveType for a typestatic long
getArraySize()
The size on an arraystatic int
getReferenceSize()
The size of a pointerint
getSize()
Returns the size in memory this type occupiesjava.lang.Class<?>
getType()
The representing typestatic PrimitiveType
valueOf(java.lang.String name)
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 Detail
-
BOOLEAN
public static final PrimitiveType BOOLEAN
boolean.class
-
BYTE
public static final PrimitiveType BYTE
byte.class
-
CHAR
public static final PrimitiveType CHAR
char.class
-
SHORT
public static final PrimitiveType SHORT
short.class
-
INT
public static final PrimitiveType INT
int.class
-
FLOAT
public static final PrimitiveType FLOAT
float.class
-
DOUBLE
public static final PrimitiveType DOUBLE
double.class
-
LONG
public static final PrimitiveType LONG
long.class
-
-
Method Detail
-
values
public static PrimitiveType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (PrimitiveType c : PrimitiveType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static PrimitiveType valueOf(java.lang.String name)
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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getSize
public int getSize()
Returns the size in memory this type occupies- Returns:
- size in bytes
-
getType
public java.lang.Class<?> 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
public static PrimitiveType forType(java.lang.Class<?> type)
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
-
-