try { target = (Collection) source.getClass().newInstance(); model2target.put(source,target); } catch (InstantiationException ie){ throw new RuntimeException(ie); } catch (IllegalAccessException iae){ throw new RuntimeException(iae); }
if (Set.class.isAssignableFrom(source.getClass())) { target = new HashSet(); } else if (List.class.isAssignableFrom(source.getClass())) { target = new ArrayList(); } else { throw new RuntimeException("Unknown collection type: " +source.getClass()); } model2target.put(source,target);
	public Collection findCollection(Collection source){		if (source==null) return null;				Collection target = (Collection) model2target.get(source);		if (null==target) {			try { 				target = (Collection) source.getClass().newInstance(); // TODO do we want to use the map here?				model2target.put(source,target);			} catch (InstantiationException ie){				throw new RuntimeException(ie);			} catch (IllegalAccessException iae){				throw new RuntimeException(iae);			}		}		return target;	}