Class TypeUtils


  • public class TypeUtils
    extends java.lang.Object
    Utils methods for data type.
    • Constructor Summary

      Constructors 
      Constructor Description
      TypeUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Class<?> convertPrimitiveToWrapperType​(java.lang.Class<?> primitive)  
      static java.lang.Class<?> convertWrapperToPrimitiveType​(java.lang.Class<?> wrapperType)  
      static boolean isBigDecimalType​(java.lang.Class<?> type)
      Checks if the type is a BigDecimal type.
      static boolean isBooleanType​(java.lang.Class<?> type)
      Checks if the type is a boolean type.
      static boolean isIntegerType​(java.lang.Class<?> type)
      Checks if the type is an integer type.
      static boolean isLongType​(java.lang.Class<?> type)
      Checks if the type is a long type.
      static boolean isNumericType​(java.lang.Class<?> type)
      Checks if the type is a numeric type.
      static boolean isPrimitive​(java.lang.Class<?> primitive)  
      static boolean isPrimitiveWrapper​(java.lang.Class<?> wrapperType)  
      static boolean isStringType​(java.lang.Class<?> type)
      Checks if the type is a string type.
      static boolean isTemporalType​(java.lang.Class<?> type)
      Checks if the type is a temporal type such as Date, Calendar, long or double that can be used to represent date or time.
      static boolean isVisualType​(java.lang.Class<?> type)
      Checks if the type is a type that can be visualized such as color, image or icon.
      • Methods inherited from class java.lang.Object

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

      • TypeUtils

        public TypeUtils()
    • Method Detail

      • isPrimitive

        public static boolean isPrimitive​(java.lang.Class<?> primitive)
      • isPrimitiveWrapper

        public static boolean isPrimitiveWrapper​(java.lang.Class<?> wrapperType)
      • convertPrimitiveToWrapperType

        public static java.lang.Class<?> convertPrimitiveToWrapperType​(java.lang.Class<?> primitive)
      • convertWrapperToPrimitiveType

        public static java.lang.Class<?> convertWrapperToPrimitiveType​(java.lang.Class<?> wrapperType)
      • isNumericType

        public static boolean isNumericType​(java.lang.Class<?> type)
        Checks if the type is a numeric type.
        Parameters:
        type - the data type.
        Returns:
        true if it is numeric type including all subclasses of Number, double, int, float, short and long.
      • isIntegerType

        public static boolean isIntegerType​(java.lang.Class<?> type)
        Checks if the type is an integer type.
        Parameters:
        type - the data type.
        Returns:
        true if it is numeric type including all subclasses of Integer or int.
      • isLongType

        public static boolean isLongType​(java.lang.Class<?> type)
        Checks if the type is a long type.
        Parameters:
        type - the data type.
        Returns:
        true if it is numeric type including all subclasses of Long or long.
      • isBigDecimalType

        public static boolean isBigDecimalType​(java.lang.Class<?> type)
        Checks if the type is a BigDecimal type.
        Parameters:
        type - the data type.
        Returns:
        true if it is numeric type including all subclasses of BigDecimal.
      • isStringType

        public static boolean isStringType​(java.lang.Class<?> type)
        Checks if the type is a string type.
        Parameters:
        type - the data type.
        Returns:
        true if it is numeric type including all subclasses of String.
      • isBooleanType

        public static boolean isBooleanType​(java.lang.Class<?> type)
        Checks if the type is a boolean type.
        Parameters:
        type - the data type.
        Returns:
        true if it is a boolean
      • isTemporalType

        public static boolean isTemporalType​(java.lang.Class<?> type)
        Checks if the type is a temporal type such as Date, Calendar, long or double that can be used to represent date or time.
        Parameters:
        type - the data type.
        Returns:
        true if it is temporal type including all subclasses.
      • isVisualType

        public static boolean isVisualType​(java.lang.Class<?> type)
        Checks if the type is a type that can be visualized such as color, image or icon.
        Parameters:
        type - the data type.
        Returns:
        true if it is visual type including all subclasses.