Class TypeUtils


  • public class TypeUtils
    extends Object
    • Field Detail

      • CLASS_JSON_OBJECT_1x

        public static final Class CLASS_JSON_OBJECT_1x
      • FIELD_JSON_OBJECT_1x_map

        public static final Field FIELD_JSON_OBJECT_1x_map
      • CLASS_JSON_ARRAY_1x

        public static final Class CLASS_JSON_ARRAY_1x
      • CLASS_SINGLE_SET

        public static final Class CLASS_SINGLE_SET
      • CLASS_SINGLE_LIST

        public static final Class CLASS_SINGLE_LIST
      • CLASS_UNMODIFIABLE_COLLECTION

        public static final Class CLASS_UNMODIFIABLE_COLLECTION
      • CLASS_UNMODIFIABLE_LIST

        public static final Class CLASS_UNMODIFIABLE_LIST
      • CLASS_UNMODIFIABLE_SET

        public static final Class CLASS_UNMODIFIABLE_SET
      • CLASS_UNMODIFIABLE_SORTED_SET

        public static final Class CLASS_UNMODIFIABLE_SORTED_SET
      • CLASS_UNMODIFIABLE_NAVIGABLE_SET

        public static final Class CLASS_UNMODIFIABLE_NAVIGABLE_SET
      • METHOD_TYPE_SUPPLIER

        public static final MethodType METHOD_TYPE_SUPPLIER
      • METHOD_TYPE_FUNCTION

        public static final MethodType METHOD_TYPE_FUNCTION
      • METHOD_TYPE_TO_INT_FUNCTION

        public static final MethodType METHOD_TYPE_TO_INT_FUNCTION
      • METHOD_TYPE_TO_LONG_FUNCTION

        public static final MethodType METHOD_TYPE_TO_LONG_FUNCTION
      • METHOD_TYPE_OBJECT_INT_CONSUMER

        public static final MethodType METHOD_TYPE_OBJECT_INT_CONSUMER
      • METHOD_TYPE_INT_FUNCTION

        public static final MethodType METHOD_TYPE_INT_FUNCTION
      • METHOD_TYPE_LONG_FUNCTION

        public static final MethodType METHOD_TYPE_LONG_FUNCTION
      • METHOD_TYPE_BI_FUNCTION

        public static final MethodType METHOD_TYPE_BI_FUNCTION
      • METHOD_TYPE_BI_CONSUMER

        public static final MethodType METHOD_TYPE_BI_CONSUMER
      • METHOD_TYPE_VOO

        public static final MethodType METHOD_TYPE_VOO
      • METHOD_TYPE_OBJECT

        public static final MethodType METHOD_TYPE_OBJECT
      • METHOD_TYPE_OBJECT_OBJECT

        public static final MethodType METHOD_TYPE_OBJECT_OBJECT
      • METHOD_TYPE_INT_OBJECT

        public static final MethodType METHOD_TYPE_INT_OBJECT
      • METHOD_TYPE_LONG_OBJECT

        public static final MethodType METHOD_TYPE_LONG_OBJECT
      • METHOD_TYPE_VOID_OBJECT_INT

        public static final MethodType METHOD_TYPE_VOID_OBJECT_INT
      • METHOD_TYPE_OBJECT_LONG

        public static final MethodType METHOD_TYPE_OBJECT_LONG
      • METHOD_TYPE_VOID_LONG

        public static final MethodType METHOD_TYPE_VOID_LONG
      • METHOD_TYPE_OBJECT_OBJECT_OBJECT

        public static final MethodType METHOD_TYPE_OBJECT_OBJECT_OBJECT
      • METHOD_TYPE_VOID

        public static final MethodType METHOD_TYPE_VOID
      • METHOD_TYPE_VOID_INT

        public static final MethodType METHOD_TYPE_VOID_INT
      • METHOD_TYPE_VOID_STRING

        public static final MethodType METHOD_TYPE_VOID_STRING
      • METHOD_TYPE_OBJECT_INT

        public static final MethodType METHOD_TYPE_OBJECT_INT
      • BIGINT_INT32_MIN

        public static final BigInteger BIGINT_INT32_MIN
      • BIGINT_INT32_MAX

        public static final BigInteger BIGINT_INT32_MAX
      • BIGINT_INT64_MIN

        public static final BigInteger BIGINT_INT64_MIN
      • BIGINT_INT64_MAX

        public static final BigInteger BIGINT_INT64_MAX
      • SMALL_10_POW

        public static final double[] SMALL_10_POW
        All the positive powers of 10 that can be represented exactly in double/float.
    • Constructor Detail

      • TypeUtils

        public TypeUtils()
    • Method Detail

      • newProxyInstance

        public static <T> T newProxyInstance​(Class<T> objectClass,
                                             JSONObject object)
      • toString

        public static String toString​(char ch)
      • toString

        public static String toString​(byte ch)
      • toString

        public static String toString​(char c0,
                                      char c1)
      • toString

        public static String toString​(byte c0,
                                      byte c1)
      • intern

        public static Type intern​(Type type)
      • doubleValue

        public static double doubleValue​(boolean isNegative,
                                         int decExp,
                                         char[] digits,
                                         int nDigits)
      • floatValue

        public static float floatValue​(boolean isNegative,
                                       int decExponent,
                                       char[] digits,
                                       int nDigits)
      • getMapping

        public static Class<?> getMapping​(Type type)
      • toDate

        public static Date toDate​(Object obj)
      • toStringArray

        public static String[] toStringArray​(Object object)
      • cast

        public static <T> T cast​(Object obj,
                                 Type type)
      • cast

        public static <T> T cast​(Object obj,
                                 Class<T> targetClass)
      • getTypeName

        public static String getTypeName​(Class type)
      • getMapping

        public static Class getMapping​(String typeName)
      • toBigDecimal

        public static BigDecimal toBigDecimal​(long i)
      • toBigDecimal

        public static BigDecimal toBigDecimal​(float f)
      • toBigDecimal

        public static BigDecimal toBigDecimal​(double d)
      • toBigDecimal

        public static BigDecimal toBigDecimal​(char[] chars)
      • toBigDecimal

        public static BigDecimal toBigDecimal​(byte[] strBytes)
      • isInt32

        public static boolean isInt32​(BigInteger value)
      • isInt64

        public static boolean isInt64​(BigInteger value)
      • isInteger

        public static boolean isInteger​(BigDecimal decimal)
        decimal is integer, check has non-zero small
        Parameters:
        decimal -
        Returns:
      • toLong

        public static Long toLong​(Object value)
      • toLongValue

        public static long toLongValue​(Object value)
      • parseBoolean

        public static Boolean parseBoolean​(byte[] bytes,
                                           int off,
                                           int len)
      • parseBoolean

        public static Boolean parseBoolean​(char[] bytes,
                                           int off,
                                           int len)
      • parseInt

        public static int parseInt​(byte[] bytes,
                                   int off,
                                   int len)
      • parseInt

        public static int parseInt​(char[] bytes,
                                   int off,
                                   int len)
      • parseLong

        public static long parseLong​(byte[] bytes,
                                     int off,
                                     int len)
      • parseLong

        public static long parseLong​(char[] bytes,
                                     int off,
                                     int len)
      • parseBigDecimal

        public static BigDecimal parseBigDecimal​(char[] bytes,
                                                 int off,
                                                 int len)
      • parseBigDecimal

        public static BigDecimal parseBigDecimal​(byte[] bytes,
                                                 int off,
                                                 int len)
      • toByte

        public static Byte toByte​(Object value)
      • toByteValue

        public static byte toByteValue​(Object value)
      • toShort

        public static Short toShort​(Object value)
      • toShortValue

        public static short toShortValue​(Object value)
      • toIntValue

        public static int toIntValue​(Object value)
      • toBooleanValue

        public static boolean toBooleanValue​(Object value)
      • toFloatValue

        public static float toFloatValue​(Object value)
      • toFloat

        public static Float toFloat​(Object value)
      • toDoubleValue

        public static double toDoubleValue​(Object value)
      • toDouble

        public static Double toDouble​(Object value)
      • compare

        public static int compare​(Object a,
                                  Object b)
      • getDefaultValue

        public static Object getDefaultValue​(Type paramType)
      • loadClass

        public static Class loadClass​(String className)
      • getArrayClass

        public static Class<?> getArrayClass​(Class componentClass)
      • nonePrimitive

        public static Class nonePrimitive​(Class type)
      • getClass

        public static Class<?> getClass​(Type type)
      • isProxy

        public static boolean isProxy​(Class<?> clazz)
      • getInnerMap

        public static Map getInnerMap​(Map object)
      • isFunction

        public static boolean isFunction​(Class type)
      • isInteger

        public static boolean isInteger​(String str)
      • isInteger

        public static boolean isInteger​(byte[] str,
                                        int off,
                                        int len)
      • isInteger

        public static boolean isInteger​(char[] str,
                                        int off,
                                        int len)
      • isNumber

        public static boolean isNumber​(String str)
      • isNumber

        public static boolean isNumber​(byte[] str,
                                       int off,
                                       int len)
      • isNumber

        public static boolean isNumber​(char[] str,
                                       int off,
                                       int len)
      • isUUID

        public static boolean isUUID​(String str)
      • validateIPv4

        public static boolean validateIPv4​(String str)
      • validateIPv6

        public static boolean validateIPv6​(String str)
      • doubleValue

        public static double doubleValue​(int signNum,
                                         long intCompact,
                                         int scale)
      • floatValue

        public static float floatValue​(int signNum,
                                       long intCompact,
                                       int scale)
      • isJavaScriptSupport

        public static boolean isJavaScriptSupport​(long i)
      • isJavaScriptSupport

        public static boolean isJavaScriptSupport​(BigDecimal i)
      • isJavaScriptSupport

        public static boolean isJavaScriptSupport​(BigInteger i)
      • getMapValueType

        public static Type getMapValueType​(Type fieldType)