mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-16 12:16:12 +00:00
perf[reflection]: 优化异常类型
This commit is contained in:
1 parent
920d6c140a
commit
a7399d126b
1 file changed
+4
-4
@@ -189,7 +189,7 @@ public abstract class ReflectionUtils {
|
|||||||
try {
|
try {
|
||||||
return newInstance(clazz.getDeclaredConstructor());
|
return newInstance(clazz.getDeclaredConstructor());
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
throw new RuntimeException(StringUtils.format("[{}]无法被实例化", clazz));
|
throw new RunException("[{}]无法被实例化", clazz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ public abstract class ReflectionUtils {
|
|||||||
try {
|
try {
|
||||||
return constructor.newInstance();
|
return constructor.newInstance();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(StringUtils.format("[{}]无法被实例化", constructor));
|
throw new RunException("[{}]无法被实例化", constructor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ public abstract class ReflectionUtils {
|
|||||||
clazz.getDeclaredMethod(methodName, null);
|
clazz.getDeclaredMethod(methodName, null);
|
||||||
return methodName;
|
return methodName;
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
throw new RuntimeException(StringUtils.format("field:[{}] has no getMethod or isMethod in class:[{}]", field.getName(), clazz.getCanonicalName()));
|
throw new RunException("field:[{}] has no getMethod or isMethod in class:[{}]", field.getName(), clazz.getCanonicalName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,7 +352,7 @@ public abstract class ReflectionUtils {
|
|||||||
clazz.getDeclaredMethod(methodName, field.getType());
|
clazz.getDeclaredMethod(methodName, field.getType());
|
||||||
return methodName;
|
return methodName;
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
throw new RuntimeException(StringUtils.format("field:[{}] has no setMethod in class:[{}]", field.getName(), clazz.getCanonicalName()));
|
throw new RunException("field:[{}] has no setMethod in class:[{}]", field.getName(), clazz.getCanonicalName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user