Class Primitives


  • public final class Primitives
    extends java.lang.Object
    Utility class for primitives.
    Since:
    1.2.1
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Map BOX  
      private static java.util.Map NAMED_PRIMITIVE  
      private static java.util.Map REPRESENTING_CHAR  
      private static java.util.Map UNBOX  
    • Constructor Summary

      Constructors 
      Constructor Description
      Primitives()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Class box​(java.lang.Class type)
      Get the boxed type for a primitive.
      static boolean isBoxed​(java.lang.Class type)
      Check for a boxed type.
      static java.lang.Class primitiveType​(java.lang.String name)
      Get the primitive type by name.
      static char representingChar​(java.lang.Class type)
      Get the representing character of a primitive type.
      static java.lang.Class unbox​(java.lang.Class type)
      Get the primitive type for a boxed one.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • BOX

        private static final java.util.Map BOX
      • UNBOX

        private static final java.util.Map UNBOX
      • NAMED_PRIMITIVE

        private static final java.util.Map NAMED_PRIMITIVE
      • REPRESENTING_CHAR

        private static final java.util.Map REPRESENTING_CHAR
    • Constructor Detail

      • Primitives

        public Primitives()
    • Method Detail

      • box

        public static java.lang.Class box​(java.lang.Class type)
        Get the boxed type for a primitive.
        Parameters:
        type - the primitive type
        Returns:
        the boxed type or null
      • unbox

        public static java.lang.Class unbox​(java.lang.Class type)
        Get the primitive type for a boxed one.
        Parameters:
        type - the boxed type
        Returns:
        the primitive type or null
      • isBoxed

        public static boolean isBoxed​(java.lang.Class type)
        Check for a boxed type.
        Parameters:
        type - the type to check
        Returns:
        true if the type is boxed
        Since:
        1.4
      • primitiveType

        public static java.lang.Class primitiveType​(java.lang.String name)
        Get the primitive type by name.
        Parameters:
        name - the name of the type
        Returns:
        the Java type or null
        Since:
        1.4
      • representingChar

        public static char representingChar​(java.lang.Class type)
        Get the representing character of a primitive type.
        Parameters:
        type - the primitive type
        Returns:
        the representing character or 0
        Since:
        1.4