@Test public void shouldFindSingleArgumentVoidMethodAndRecognizeItAsASetterNevermindingNamingConvention() { Method method = reflectionSetterInvoker.findSetter(ReflectionSetterInvokerTestObject.class, "TEST"); assertThat(method.getName()).isEqualTo("inconventionalSetter"); }
public Method findSetter(Class<?> setterHostClass, Object forArg) { Class<?> argClass = forArg.getClass(); Map<Class<?>, Setter> settersMap = setterCache.get(setterHostClass); if (settersMap == null) { settersMap = new ConcurrentHashMap<Class<?>, Setter>(); setterCache.put(getClass(), settersMap); } Setter setter = settersMap.get(argClass); if (setter == null) { Method method = lookupSetter(setterHostClass, argClass); setter = new Setter(method); settersMap.put(argClass, setter); } return setter.getMethod(); }
ReflectionSetterInvoker { public Method findSetter(Class<?> setterHostClass, Object forArg) { Class<?> argClass = forArg.getClass(); Map<Class<?>, Setter> settersMap = setterCache.get(setterHostClass); if (settersMap == null) { settersMap = new ConcurrentHashMap<Class<?>, Setter>(); setterCache.put(getClass(), settersMap); } Setter setter = settersMap.get(argClass); if (setter == null) { Method method = lookupSetter(setterHostClass, argClass); setter = new Setter(method); settersMap.put(argClass, setter); } return setter.getMethod(); } }
ReflectionSetterInvoker { public Method findSetter(Class<?> setterHostClass, Object forArg) { Class<?> argClass = forArg.getClass(); Map<Class<?>, Setter> settersMap = setterCache.get(setterHostClass); if (settersMap == null) { settersMap = new ConcurrentHashMap<Class<?>, Setter>(); setterCache.put(getClass(), settersMap); } Setter setter = settersMap.get(argClass); if (setter == null) { Method method = lookupSetter(setterHostClass, argClass); setter = new Setter(method); settersMap.put(argClass, setter); } return setter.getMethod(); }  }
ReflectionSetterInvoker { public Method findSetter(Class<?> setterHostClass, Object forArg) { Class<?> argClass = forArg.getClass(); Map<Class<?>, Setter> settersMap = setterCache.get(setterHostClass); if (settersMap == null) { settersMap = new ConcurrentHashMap<Class<?>, Setter>(); setterCache.put(getClass(), settersMap); } Setter setter = settersMap.get(argClass); if (setter == null) { Method method = lookupSetter(setterHostClass, argClass); setter = new Setter(method); settersMap.put(argClass, setter); } return setter.getMethod(); }  boolean invokeSetter(Object setterHostObject, Object forArg); static void invokerSetter(Method setter, Object setterHostObject, Object argument); Method findSetter(Class<?> setterHostClass, Object forArg); }
ReflectionSetterInvoker { public Method findSetter(Class<?> setterHostClass, Object forArg) { Class<?> argClass = forArg.getClass(); Map<Class<?>, Setter> settersMap = setterCache.get(setterHostClass); if (settersMap == null) { settersMap = new ConcurrentHashMap<Class<?>, Setter>(); setterCache.put(getClass(), settersMap); } Setter setter = settersMap.get(argClass); if (setter == null) { Method method = lookupSetter(setterHostClass, argClass); setter = new Setter(method); settersMap.put(argClass, setter); } return setter.getMethod(); }  boolean invokeSetter(Object setterHostObject, Object forArg); static void invokerSetter(Method setter, Object setterHostObject, Object argument); Method findSetter(Class<?> setterHostClass, Object forArg);  }