Class Util


  • public class Util
    extends Object
    A few utility methods, mostly for private use.
    Author:
    Nathan Sweet
    • Field Detail

      • isAndroid

        public static final boolean isAndroid
    • Constructor Detail

      • Util

        public Util()
    • Method Detail

      • isClassAvailable

        public static boolean isClassAvailable​(String className)
      • getWrapperClass

        public static Class getWrapperClass​(Class type)
        Returns the primitive wrapper class for a primitive class.
        Parameters:
        type - Must be a primitive class.
      • getPrimitiveClass

        public static Class getPrimitiveClass​(Class type)
        Returns the primitive class for a primitive wrapper class. Otherwise returns the type parameter.
        Parameters:
        type - Must be a wrapper class.
      • isWrapperClass

        public static boolean isWrapperClass​(Class type)
      • log

        public static void log​(String message,
                               Object object)
        Logs a message about an object. The log level and the string format of the object depend on the object type.
      • string

        public static String string​(Object object)
        Returns the object formatted as a string. The format depends on the object's type and whether Object.toString() has been overridden.
      • className

        public static String className​(Class type)
        Returns the class formatted as a string. The format varies depending on the type.
      • getDimensionCount

        public static int getDimensionCount​(Class arrayClass)
        Returns the number of dimensions of an array.
      • getElementClass

        public static Class getElementClass​(Class arrayClass)
        Returns the base element type of an n-dimensional array class.