private void injectObject(Object target, Object o2, Field f, Class genericTypeClass) { if (genericTypeClass.isAssignableFrom(o2.getClass())) { List tempList = Lists.newArrayList(); Object listInstance; try { listInstance = ReflectionUtil.getFieldValueByName(target, f.getName()); } catch (NoSuchFieldException e) { throw new RuntimeException("Object insertion has failed."); } catch (IllegalAccessException e) { throw new RuntimeException("Object insertion has failed."); } if (listInstance != null) { tempList.addAll((Collection) listInstance); } tempList.add(o2); ReflectionUtil.setToField(f, target, tempList); } }