From deb5c95710a771a7285ee84e78620b371082f823 Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 5 Jul 2017 16:44:02 +0900 Subject: [PATCH] Spring bean reflection --- .../java/com/loafle/overflow/proxy/ServiceInvoker.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/loafle/overflow/proxy/ServiceInvoker.java b/src/main/java/com/loafle/overflow/proxy/ServiceInvoker.java index 2f248ea..7bf22ab 100644 --- a/src/main/java/com/loafle/overflow/proxy/ServiceInvoker.java +++ b/src/main/java/com/loafle/overflow/proxy/ServiceInvoker.java @@ -169,9 +169,15 @@ public class ServiceInvoker { private Object getValue(Cache.ParameterCache parameterCache, String json) throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { Object result = null; if (List.class == parameterCache.clazz) { + if (null == parameterCache.genericClazzes || 1 != parameterCache.genericClazzes.length) { + throw new IllegalArgumentException(); + } result = objectMapper.readValue(json, objectMapper.getTypeFactory().constructCollectionType(List.class, parameterCache.genericClazzes[0])); } else if (Map.class == parameterCache.clazz) { - + if (null == parameterCache.genericClazzes || 2 != parameterCache.genericClazzes.length) { + throw new IllegalArgumentException(); + } + result = objectMapper.readValue(json, objectMapper.getTypeFactory().constructMapType(Map.class, parameterCache.genericClazzes[0], parameterCache.genericClazzes[1])); } else if (parameterCache.clazz.isPrimitive()) { Class wrapperClazz = Primitives.wrap(parameterCache.clazz); Constructor con = wrapperClazz.getConstructor(String.class);