From a7399d126befb0808acf6d3d3cf2fe078a7d5ee1 Mon Sep 17 00:00:00 2001 From: jaysunxiao Date: Tue, 3 Aug 2021 11:47:58 +0800 Subject: [PATCH] =?UTF-8?q?perf[reflection]:=20=E4=BC=98=E5=8C=96=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/zfoo/protocol/util/ReflectionUtils.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/protocol/src/main/java/com/zfoo/protocol/util/ReflectionUtils.java b/protocol/src/main/java/com/zfoo/protocol/util/ReflectionUtils.java index 1fc797a1..21f493c8 100644 --- a/protocol/src/main/java/com/zfoo/protocol/util/ReflectionUtils.java +++ b/protocol/src/main/java/com/zfoo/protocol/util/ReflectionUtils.java @@ -189,7 +189,7 @@ public abstract class ReflectionUtils { try { return newInstance(clazz.getDeclaredConstructor()); } catch (NoSuchMethodException e) { - throw new RuntimeException(StringUtils.format("[{}]无法被实例化", clazz)); + throw new RunException("[{}]无法被实例化", clazz); } } @@ -197,7 +197,7 @@ public abstract class ReflectionUtils { try { return constructor.newInstance(); } 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); return methodName; } 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()); return methodName; } 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()); } }