public enum TypeUtil extends Enum<TypeUtil>
| 限定符和类型 | 方法和说明 |
|---|---|
static Type |
findActualType(Type rawType)
查找真实的数据类型
如果rawType == Class,则真实的数据类型为rawType
如果rawType是泛型类型,且泛型容器为内置数据类型,则真实数据类型为其泛型,否则真实数据类型为rawType
|
static boolean |
isAsyncType(Type rawType)
检测当前type是否是异步type
|
static boolean |
isPrimitiveType(Type rawType)
检测type是否是基本数据类型,支持的情形为
基本数据类型
基本数据类型的封装类型
内置泛型类型为基本数据类型的封装类型,如CompletableFuture<Integer>
|
static boolean |
isPrimitiveType(Type rawType,
Class<?> primitiveWrapperType)
检测type是否是基本数据类型,支持的情形为
基本数据类型
基本数据类型的封装类型
内置泛型类型为基本数据类型的封装类型,如CompletableFuture<Integer>
|
static boolean |
isTypeOf(Type rawType,
Type targetType)
检测type是否是指定的数据类型,支持的情形为
rawType == targetType
rawType为内置泛型类型,targetType为泛型,如CompletableFuture<Integer>
rawType 为 targetType 的子类,如rawType=InputStream.class,targetType=FileInputStream.class
rawType为内置泛型类型,targetType为具体类型的子类,如rawType=CompletableFuture<InputStream>,targetType=FileInputStream.class
|
static boolean |
isVoidType(Type rawType)
检测type是否是void类型,支持的情形为
void
Void
内置泛型类型为Void,如CompletableFuture<Void>
|
static <T> T |
resolvePrimitiveTypeValue(String value,
Type primitiveType)
解析字符串为基本数据类型的值
|
static TypeUtil |
valueOf(String name)
返回带有指定名称的该类型的枚举常量。
|
static TypeUtil[] |
values()
按照声明该枚举类型的常量的顺序, 返回
包含这些常量的数组。
|
public static TypeUtil[] values()
for (TypeUtil c : TypeUtil.values()) System.out.println(c);
public static TypeUtil valueOf(String name)
name - 要返回的枚举常量的名称。IllegalArgumentException - 如果该枚举类型没有带有指定名称的常量NullPointerException - 如果参数为空值public static boolean isVoidType(Type rawType)
public static <T> T resolvePrimitiveTypeValue(String value, Type primitiveType)
public static boolean isPrimitiveType(Type rawType)
rawType - 原始类型builtinTypespublic static boolean isPrimitiveType(Type rawType, Class<?> primitiveWrapperType)
rawType - 原始类型primitiveWrapperType - 基本数据类型的封装类型builtinTypespublic static boolean isAsyncType(Type rawType)
Future,
CompletableFuturepublic static Type findActualType(Type rawType)
public static boolean isTypeOf(Type rawType, Type targetType)
builtinTypesCopyright © 2019. All rights reserved.