@Override protected void createObject(EObject peekObject, EStructuralFeature feature) { if (!isNull()) { String xsiType = getXSIType(); Map<String, Map<EClassifier, String>> featureToTypeMap = xsiType == null ? UML212UMLExtendedMetaData.getFeatureToTypeMap() : null; Map<EClassifier, String> typeMap = featureToTypeMap == null ? null : featureToTypeMap.get(feature.getName()); if (typeMap != null) { EObject eObject = peekObject instanceof AnyType ? (EObject) objects.get(objects.size() - 2) : peekObject; for (Map.Entry<EClassifier, String> entry : typeMap.entrySet()) { if (entry.getKey().isInstance(eObject)) { xsiType = entry.getValue(); break; } } } if (xsiType != null) { createObjectFromTypeName(peekObject, xsiType, feature); } else { super.createObject(peekObject, feature); } } }
@Override protected EObject validateCreateObjectFromFactory(EFactory factory, String typeName, EObject newObject, EStructuralFeature feature) { if (!(objects.peek() instanceof AnyType) && newObject != null && newObject.eIsProxy() && !sameDocumentProxies.contains(newObject)) { URI proxyURI = ((InternalEObject) newObject).eProxyURI(); Map<String, EObject> typeNamesToProxies = urisToProxies .get(proxyURI); if (typeNamesToProxies == null) { urisToProxies.put(proxyURI, typeNamesToProxies = new HashMap<String, EObject>()); } EObject proxy = typeNamesToProxies.get(typeName); if (proxy == null) { typeNamesToProxies.put(typeName, proxy = newObject); } // canonicalize proxies newObject = proxy; } return super.validateCreateObjectFromFactory(factory, typeName, newObject, feature); }
this.helper = helper; elements = new MyStack<String>(); objects = new MyEObjectStack(); mixedTargets = new MyStack<FeatureMap>();
EObject peekObject = objects.peekEObject(); if (kind == XMLHelper.DATATYPE_SINGLE || kind == XMLHelper.DATATYPE_IS_MANY) objects.push(null); mixedTargets.push(null); types.push(feature); objects.push(null); mixedTargets.push(null); types.push(feature); EObject childObject = objects.peekEObject(); if (childObject != null) objects.push(null); mixedTargets.push(null); types.push(simpleFeature);
EObject peekObject = objects.peekEObject(); if (!(peekObject instanceof AnyType)) AnyType anyType = getExtension(objects.peekEObject()); EStructuralFeature entryFeature = extendedMetaData.demandFeature(extendedMetaData.getNamespace(feature), extendedMetaData.getName(feature), true); String name = extendedMetaData.getName(feature); EStructuralFeature wildcardFeature = extendedMetaData.getElementWildcardAffiliation((objects.peekEObject()).eClass(), namespace, name); if (wildcardFeature != null) result = createObjectFromFactory(factory, typeName); EObject peekObject = objects.peekEObject(); if (!(peekObject instanceof AnyType)) String name = extendedMetaData.getName(feature); EStructuralFeature wildcardFeature = extendedMetaData.getElementWildcardAffiliation((objects.peekEObject()).eClass(), namespace, name); if (wildcardFeature != null)
this.helper = helper; elements = new MyStack<String>(); objects = new MyEObjectStack(); mixedTargets = new MyStack<FeatureMap>();
objects.pop(); types.pop(); mixedTargets.pop();
objects.pop(); types.pop(); mixedTargets.pop();
EObject peekObject = objects.peekEObject(); if (kind == XMLHelper.DATATYPE_SINGLE || kind == XMLHelper.DATATYPE_IS_MANY) objects.push(null); mixedTargets.push(null); types.push(feature); objects.push(null); mixedTargets.push(null); types.push(feature); EObject childObject = objects.peekEObject(); if (childObject != null) objects.push(null); mixedTargets.push(null); types.push(simpleFeature);
EObject peekObject = objects.peekEObject(); if (!(peekObject instanceof AnyType)) AnyType anyType = getExtension(objects.peekEObject()); EStructuralFeature entryFeature = extendedMetaData.demandFeature(extendedMetaData.getNamespace(feature), extendedMetaData.getName(feature), true); String name = extendedMetaData.getName(feature); EStructuralFeature wildcardFeature = extendedMetaData.getElementWildcardAffiliation((objects.peekEObject()).eClass(), namespace, name); if (wildcardFeature != null) result = createObjectFromFactory(factory, typeName); EObject peekObject = objects.peekEObject(); if (!(peekObject instanceof AnyType)) String name = extendedMetaData.getName(feature); EStructuralFeature wildcardFeature = extendedMetaData.getElementWildcardAffiliation((objects.peekEObject()).eClass(), namespace, name); if (wildcardFeature != null)
objects.remove(0); mixedTargets.remove(0); types.remove(0); EObject peekObject = objects.peek(); if (peekObject == null) if (objects.size() > 1) EcoreUtil.remove(peekObject = objects.get(0)); objects.set(0, simpleAnyType); types.set(0, XMLTypePackage.Literals.SIMPLE_ANY_TYPE__RAW_VALUE); mixedTargets.set(0, simpleAnyType.getMixed());
objects.remove(0); mixedTargets.remove(0); types.remove(0); EObject peekObject = objects.peek(); if (peekObject == null) if (objects.size() > 1) EcoreUtil.remove(peekObject = objects.get(0)); objects.set(0, simpleAnyType); types.set(0, XMLTypePackage.Literals.SIMPLE_ANY_TYPE__RAW_VALUE); mixedTargets.set(0, simpleAnyType.getMixed());
objects.push(null); mixedTargets.push(null); types.push(simpleFeature);
objects.pop(); mixedTargets.pop(); EObject object = objects.popEObject(); if (mixedTargets.peek() != null && (object.eContainer() != null || objects.pop(); mixedTargets.pop(); if (text != null) setValueFromId(objects.peekEObject(), (EReference)type, text.toString()); text = null; EObject eObject = objects.popEObject(); mixedTargets.pop(); if (eObject == null) eObject = objects.peekEObject(); objects.pop(); mixedTargets.pop(); isSimpleFeature = false;
objects.pop(); mixedTargets.pop(); EObject object = objects.popEObject(); if (mixedTargets.peek() != null && (object.eContainer() != null || objects.pop(); mixedTargets.pop(); if (text != null) setValueFromId(objects.peekEObject(), (EReference)type, text.toString()); text = null; EObject eObject = objects.popEObject(); mixedTargets.pop(); if (eObject == null) eObject = objects.peekEObject(); objects.pop(); mixedTargets.pop(); isSimpleFeature = false;
objects.clear(); mixedTargets.clear(); contextFeature = null;
objects.push(null); mixedTargets.push(null); types.push(simpleFeature);
objects.push(object); types.push(OBJECT_TYPE);
objects.clear(); mixedTargets.clear(); contextFeature = null;
objects.push(null); mixedTargets.push(null); types.push(OBJECT_TYPE);