PropertyCollectionMerger implements SinglePropertyValueMerger<Collection, Collection>, BeanModifierAware { @Override public Collection mergeObjects(Collection values, String[] extraParams) { if (values == null) { return null; } if (ArrayUtils.isEmpty(extraParams)) { throw new IllegalArgumentException("You need to provide the extra param should be a property name."); } String extraParam = extraParams[0]; Collection retValue = getCollectionToReturn(values); if (retValue == null) { logger.warn("Could not create proper collection of type: "+values.getClass().getName()); return null; } for (Object value : values) { Object propertyValue = modifier.readPropertyValue(extraParam, value); retValue.add(propertyValue); } return retValue; }  @Override Collection mergeObjects(Collection values, String[] extraParams); @Override void setBeanModifier(BeanModifier modifier); @Override boolean isRestoreSupported(String[] params); @Override Collection restoreObject(Collection object, String[] params);  }
@Test public void testPropertyCollectionMerger() { List<SimpleEntity> originalCollection = new LinkedList<SimpleEntity>(); originalCollection.add(new SimpleEntity("test", 10, 11.1, true)); originalCollection.add(new SimpleEntity("test2", 10, 11.1, true)); List<String> result = (List<String>) merger.mergeObjects(originalCollection, new String[] {"aString"}); assertEquals(originalCollection.get(0).getaString(), result.get(0)); assertEquals(originalCollection.get(0).getaString(), result.get(0)); }