Enum PrimitiveType

java.lang.Object
java.lang.Enum<PrimitiveType>
org.ehcache.sizeof.impl.PrimitiveType
All Implemented Interfaces:
Serializable, Comparable<PrimitiveType>, java.lang.constant.Constable

enum PrimitiveType extends Enum<PrimitiveType>
Primitive types in the VM type system and their sizes
  • Enum Constant Details

  • Field Details

    • type

      private final Class<?> type
    • size

      private final int size
  • Constructor Details

    • PrimitiveType

      private PrimitiveType(Class<?> type, int size)
  • Method Details

    • values

      public static PrimitiveType[] 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

      public static PrimitiveType valueOf(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:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getSize

      public int getSize()
      Returns the size in memory this type occupies
      Returns:
      size in bytes
    • getType

      public 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(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