private void resolveSetterConflicts(Map<String, List<Method>> conflictingSetters) { for (String propName : conflictingSetters.keySet()) { List<Method> setters = conflictingSetters.get(propName); Class<?> getterType = getTypes.get(propName); Method match = null; ReflectionException exception = null; for (Method setter : setters) { Class<?> paramType = setter.getParameterTypes()[0]; if (paramType.equals(getterType)) { // should be the best match match = setter; break; } if (exception == null) { try { match = pickBetterSetter(match, setter, propName); } catch (ReflectionException e) { // there could still be the 'best match' match = null; exception = e; } } } if (match == null) { throw exception; } else { addSetMethod(propName, match); } } }
private void resolveSetterConflicts(Map<String, List<Method>> conflictingSetters) { for (String propName : conflictingSetters.keySet()) { List<Method> setters = conflictingSetters.get(propName); Class<?> getterType = getTypes.get(propName); Method match = null; ReflectionException exception = null; for (Method setter : setters) { Class<?> paramType = setter.getParameterTypes()[0]; if (paramType.equals(getterType)) { // should be the best match match = setter; break; } if (exception == null) { try { match = pickBetterSetter(match, setter, propName); } catch (ReflectionException e) { // there could still be the 'best match' match = null; exception = e; } } } if (match == null) { throw exception; } else { addSetMethod(propName, match); } } }
Method firstMethod = setters.get(0); if (setters.size() == 1) { addSetMethod(propName, firstMethod); } else { Class expectedType = getTypes.get(propName); "specification and can cause unpredicatble results."); addSetMethod(propName, setter);