Class Primitives


  • public final class Primitives
    extends java.lang.Object
    Utility class for primitives.
    Since:
    1.2.1
    Author:
    Jörg Schaible
    • 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
    • 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