根据type类型判断是否为基本数据类型,或基本数据类型的包装类,或泛型为基本数据类型
/**
* 判断是否为基本数据类型,或基本数据类型的包装类,或泛型为基本数据类型
* string true
* int true
* Integer true
* String[] true
* user[] false
* List<string> true
* list<user> false
* Map<String,User> false
*/
private static boolean isPrimitive(Type parameterType) {
Class<?> clazz = TypeUtil.getClass(parameterType);
if (clazz.equals(String.class) || ClassUtil.isBasicType(clazz)) {
return true;
}
if ((clazz.isArray() && ClassUtil.isSimpleValueType(clazz.getComponentType()))) {
return true;
}
if (parameterType instanceof ParameterizedType) {
Type[] t = ((ParameterizedType) parameterType).getActualTypeArguments();
for (Type p : t) {
if (isPrimitive(p)) {
return true;
}
}
}
return false;
}