/** * Converts the values of an FeatureMap, the values of the collection are converted to and added * to the list in the correct feature in the modelObject. * * @param eObject the eObject from which the value is read * @param modelObject the {@link ModelObject} in which the value is to be set * @param eFeature the eFeature which is converted */ protected void convertFeatureMap( final ModelObject<?> modelObject, final EObject eObject, final EStructuralFeature eFeature) { final Collection<?> mValues = (Collection<?>) modelObject.eGet(eFeature); @SuppressWarnings("unchecked") final Collection<Object> values = (Collection<Object>) eObject.eGet(eFeature); for (final Object mValue : mValues) { final ModelFeatureMapEntry<?> mEntry = ModelResolver.getInstance().getModelFeatureMapEntry(eFeature, mValue); EStructuralFeature entryFeature = mEntry.getEStructuralFeature(); Object entryValue = mEntry.getValue(); // flatten the tree of feature map entries, feature maps maybe nested // EMF uses a flattened api, while Texo builds this actual tree of // featuremaps, the findFeature and findValue find the deepest featureMap entry if (FeatureMapUtil.isFeatureMap(entryFeature)) { final ModelFeatureMapEntry<?> modelFeatureMapEntry = ModelResolver.getInstance().getModelFeatureMapEntry(entryFeature, entryValue); entryFeature = ModelUtils.findFeature(modelFeatureMapEntry); entryValue = ModelUtils.findValue(modelFeatureMapEntry); } final Object convertedValue; if (entryFeature instanceof EAttribute) { convertedValue = convertEAttributeValue(entryValue, ((EAttribute) entryFeature).getEAttributeType()); } else { convertedValue = createTarget(entryValue); } final FeatureMap.Entry eEntry = FeatureMapUtil.createEntry(entryFeature, convertedValue); values.add(eEntry); } }