Class Primitives

java.lang.Object
org.openxava.util.Primitives

public class Primitives extends Object
Utilities to work with Java primitive data.

Primitive types are boolean, byte, char, short, int, long, float and double.

Author:
Javier Paniza
  • Constructor Details

    • Primitives

      public Primitives()
  • Method Details

    • toWrapperClass

      public static Class toWrapperClass(Class origin)
      Wrapper class corresponding to class of primitive sent.

      That is, if it receive a int.class then returns a Integer.class.

      If receives a class of a no primitive class then returns the same class.
      If receives null returns null.

    • classForName

      public static Class classForName(String type) throws ClassNotFoundException
      Class for name, but supporting primitive types and arrays of primitive types.

      If receives null returns null.

      Throws:
      ClassNotFoundException
    • toPrimitiveClass

      public static Class toPrimitiveClass(Class origin)
      Primitive class corresponding to class of wrapper class sent.

      That is, if it receive a Integer.class then returns a int.class.

      If receives a class of a no primitive wrapper class then returns the same class.
      If receives null returns null.