Package com.alibaba.fastjson2.util
Class TypeUtils
java.lang.Object
com.alibaba.fastjson2.util.TypeUtils
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BigIntegerstatic final BigIntegerstatic final BigIntegerstatic final BigIntegerstatic final Classstatic final Classstatic final Classstatic final Classstatic final Classstatic final Classstatic final Classstatic final Classstatic final Classstatic final Fieldstatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final MethodTypestatic final ParameterizedTypestatic final double[]All the positive powers of 10 that can be represented exactly in double/float. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Tstatic <T> Tcast(Object obj, Class<T> targetClass, ObjectReaderProvider provider) static <T> Tstatic Object[]static <T> Tcast(Object obj, Type type, ObjectReaderProvider provider) static intstatic doubledoubleValue(boolean isNegative, int decExp, char[] digits, int nDigits) static doubledoubleValue(int signNum, long intCompact, int scale) static floatfloatValue(boolean isNegative, int decExponent, char[] digits, int nDigits) static floatfloatValue(int signNum, long intCompact, int scale) static Class<?>getArrayClass(Class componentClass) static Class<?>static ObjectgetDefaultValue(Type paramType) static MapgetInnerMap(Map object) static Class<?>getMapping(Type type) static ClassgetMapping(String typeName) static StringgetTypeName(Class type) static Typestatic booleanisFunction(Class type) static booleanisInt32(BigInteger value) static booleanisInt64(BigInteger value) static booleanisInteger(byte[] str, int off, int len) static booleanisInteger(char[] str, int off, int len) static booleanstatic booleanisInteger(BigDecimal decimal) decimal is integer, check has non-zero smallstatic booleanisJavaScriptSupport(long i) static booleanstatic booleanstatic booleanisNumber(byte[] str, int off, int len) static booleanisNumber(char[] str, int off, int len) static booleanstatic booleanstatic booleanstatic Classstatic <T> TnewProxyInstance(Class<T> objectClass, JSONObject object) static ClassnonePrimitive(Class type) static BigDecimalparseBigDecimal(byte[] bytes, int off, int len) static BigDecimalparseBigDecimal(char[] bytes, int off, int len) static BooleanparseBoolean(byte[] bytes, int off, int len) static BooleanparseBoolean(char[] bytes, int off, int len) static doubleparseDouble(byte[] in, int off, int len) static doubleparseDouble(char[] in, int off, int len) static floatparseFloat(byte[] in, int off, int len) static floatparseFloat(char[] in, int off, int len) static intparseInt(byte[] bytes, int off, int len) static intparseInt(char[] bytes, int off, int len) static longparseLong(byte[] bytes, int off, int len) static longparseLong(char[] bytes, int off, int len) static BigDecimaltoBigDecimal(byte[] strBytes) static BigDecimaltoBigDecimal(char[] chars) static BigDecimaltoBigDecimal(double d) static BigDecimaltoBigDecimal(float f) static BigDecimaltoBigDecimal(long i) static BigDecimaltoBigDecimal(Object value) static BigDecimaltoBigDecimal(String str) static BigIntegertoBigInteger(Object value) static Booleanstatic booleantoBooleanValue(Object value) static Bytestatic bytetoByteValue(Object value) static Datestatic Doublestatic doubletoDoubleValue(Object value) static Floatstatic floattoFloatValue(Object value) static Instantstatic Integerstatic inttoIntValue(Object value) static Longstatic longtoLongValue(Object value) static Shortstatic shorttoShortValue(Object value) static StringtoString(byte ch) static StringtoString(byte c0, byte c1) static StringtoString(char ch) static StringtoString(char c0, char c1) static String[]toStringArray(Object object) static booleanvalidateIPv4(String str) static booleanvalidateIPv6(String str)
-
Field Details
-
CLASS_JSON_OBJECT_1x
-
FIELD_JSON_OBJECT_1x_map
-
CLASS_JSON_ARRAY_1x
-
CLASS_SINGLE_SET
-
CLASS_SINGLE_LIST
-
CLASS_UNMODIFIABLE_COLLECTION
-
CLASS_UNMODIFIABLE_LIST
-
CLASS_UNMODIFIABLE_SET
-
CLASS_UNMODIFIABLE_SORTED_SET
-
CLASS_UNMODIFIABLE_NAVIGABLE_SET
-
PARAM_TYPE_LIST_STR
-
METHOD_TYPE_SUPPLIER
-
METHOD_TYPE_FUNCTION
-
METHOD_TYPE_TO_INT_FUNCTION
-
METHOD_TYPE_TO_LONG_FUNCTION
-
METHOD_TYPE_OBJECT_INT_CONSUMER
-
METHOD_TYPE_INT_FUNCTION
-
METHOD_TYPE_LONG_FUNCTION
-
METHOD_TYPE_BI_FUNCTION
-
METHOD_TYPE_BI_CONSUMER
-
METHOD_TYPE_VOO
-
METHOD_TYPE_OBJECT
-
METHOD_TYPE_OBJECT_OBJECT
-
METHOD_TYPE_INT_OBJECT
-
METHOD_TYPE_LONG_OBJECT
-
METHOD_TYPE_VOID_OBJECT_INT
-
METHOD_TYPE_OBJECT_LONG
-
METHOD_TYPE_VOID_LONG
-
METHOD_TYPE_OBJECT_OBJECT_OBJECT
-
METHOD_TYPE_VOID
-
METHOD_TYPE_VOID_INT
-
METHOD_TYPE_VOID_STRING
-
METHOD_TYPE_OBJECT_INT
-
BIGINT_INT32_MIN
-
BIGINT_INT32_MAX
-
BIGINT_INT64_MIN
-
BIGINT_INT64_MAX
-
SMALL_10_POW
public static final double[] SMALL_10_POWAll the positive powers of 10 that can be represented exactly in double/float.
-
-
Constructor Details
-
TypeUtils
public TypeUtils()
-
-
Method Details
-
newProxyInstance
-
toString
-
toString
-
toString
-
toString
-
intern
-
parseDouble
- Throws:
NumberFormatException
-
parseDouble
- Throws:
NumberFormatException
-
parseFloat
- Throws:
NumberFormatException
-
parseFloat
- Throws:
NumberFormatException
-
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
-
toDate
-
toInstant
-
cast
-
toStringArray
-
cast
-
cast
-
cast
-
cast
-
getTypeName
-
getMapping
-
toBigDecimal
-
toBigDecimal
-
toBigDecimal
-
toBigDecimal
-
toBigDecimal
-
toBigDecimal
-
toBigDecimal
-
isInt32
-
isInt64
-
isInteger
decimal is integer, check has non-zero small- Parameters:
decimal-- Returns:
-
toBigInteger
-
toLong
-
toLongValue
-
parseBoolean
-
parseBoolean
-
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
-
parseBigDecimal
-
toInteger
-
toByte
-
toByteValue
-
toShort
-
toShortValue
-
toIntValue
-
toBooleanValue
-
toBoolean
-
toFloatValue
-
toFloat
-
toDoubleValue
-
toDouble
-
compare
-
getDefaultValue
-
loadClass
-
getArrayClass
-
nonePrimitive
-
getClass
-
isProxy
-
getInnerMap
-
isFunction
-
isInteger
-
isInteger
public static boolean isInteger(byte[] str, int off, int len) -
isInteger
public static boolean isInteger(char[] str, int off, int len) -
isNumber
-
isNumber
public static boolean isNumber(byte[] str, int off, int len) -
isNumber
public static boolean isNumber(char[] str, int off, int len) -
isUUID
-
validateIPv4
-
validateIPv6
-
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
-
isJavaScriptSupport
-