Java Code Examples for org.eclipse.emf.ecore.EReference#setEType()

The following examples show how to use org.eclipse.emf.ecore.EReference#setEType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EcoreUtil2Test.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testGetAllReferencedObjects() {
	EClass a = createEClass("a");
	EClass b = createEClass("b");
	
	EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
	pack.setName("empty");
	pack.setNsPrefix("empty");
	pack.setNsURI("empty");
	pack.getEClassifiers().add(a);
	pack.getEClassifiers().add(b);
	
	EReference ref = EcoreFactory.eINSTANCE.createEReference();
	a.getEStructuralFeatures().add(ref);
	ref.setUpperBound(1);
	ref.setEType(b);
	EObject objA = pack.getEFactoryInstance().create(a);
	EObject objB = pack.getEFactoryInstance().create(b);
	List<EObject> res = EcoreUtil2.getAllReferencedObjects(objA, ref);
	assertNotNull(res);
	assertTrue(res.isEmpty());
	res = EcoreUtil2.getAllReferencedObjects(objA, ref);
	assertNotNull(res);
	objA.eSet(ref, objB);
}
 
Example 2
Source File: PortableURIs.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Resolves a given portable URI fragment against the given resource.
 * 
 * @param resource
 *            the resource from which global scope to look up the EObject
 * @param portableFragment
 *            the portable fragment pointing to the to be resolved EObject
 * 
 * @return the EObject for the given portableURIFragment
 */
public EObject resolve(StorageAwareResource resource, String portableFragment) {
	PortableURIs.PortableFragmentDescription desc = fromFragmentString(portableFragment);
	EReference mock = EcoreFactory.eINSTANCE.createEReference();
	mock.setEType(desc.descriptionEClass);
	IScope scope = globalScopeProvider.getScope(resource, mock, Predicates.<IEObjectDescription>alwaysTrue());
	Optional<IEObjectDescription> description = Streams.stream( //
			scope.getElements(desc.descriptionQualifiedName)).findFirst();
	return description.map(d -> {
		EObject container = EcoreUtil.resolve(d.getEObjectOrProxy(), resource);
		return getEObject(container, desc.descriptionRelativeFragment);
	}).orElse(null);
}
 
Example 3
Source File: SerializationUtilTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
private EReference addEReference(EClass from, EClass to, String name, boolean isTransient) {
	EReference ref = EcoreFactory.eINSTANCE.createEReference();
	ref.setName("ref2");
	ref.setEType(to);
	ref.setContainment(true);
	if (isTransient) {
		ref.setTransient(true);
		ref.setDerived(true);
	}
	ref.setChangeable(true);
	from.getEStructuralFeatures().add(ref);
	return ref;
}
 
Example 4
Source File: EClassInfoTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public void testChangeable(){
	EcorePackage pack = EcorePackage.eINSTANCE;
	EClass eClass = pack.getEClass();
	EClassInfo objectUnderTest = new EClassifierInfo.EClassInfo(eClass, false, Collections.<String>emptySet(), null);
	EcoreFactory fac = EcoreFactory.eINSTANCE;
	EReference reference = fac.createEReference();
	reference.setName("newReference");
	reference.setEType(eClass);
	reference.setChangeable(true);
	reference.setContainment(true);
	eClass.getEStructuralFeatures().add(reference);
	assertEquals(true,objectUnderTest.containsCompatibleFeature("newReference", false, true, eClass, new StringBuilder()));
	reference.setChangeable(false);
	assertEquals(false,objectUnderTest.containsCompatibleFeature("newReference", false, true, eClass, new StringBuilder()));
}
 
Example 5
Source File: TypeHierarchyHelperTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
private EReference addReference(EClassInfo eClass, EClassInfo ref, String name) {
	EReference feature = EcoreFactory.eINSTANCE.createEReference();
	feature.setName(name);
	feature.setEType(ref.getEClassifier());
	eClass.getEClass().getEStructuralFeatures().add(feature);
	return feature;
}
 
Example 6
Source File: Schema.java    From BIMserver with GNU Affero General Public License v3.0 5 votes vote down vote up
public EReference createEReference(EClass eClass, String name, EClass type, Multiplicity multiplicity) {
	EReference eReference = EcoreFactory.eINSTANCE.createEReference();
	eReference.setName(name);
	if (multiplicity == Multiplicity.MANY) {
		eReference.setUpperBound(-1);
	}
	if (!isNew(eClass)) {
		changes.add(new NewReferenceChange(this, eClass.getEAllStructuralFeatures().size(), eReference));
	}
	eReference.setEType(type);
	eClass.getEStructuralFeatures().add(eReference);
	return eReference;
}
 
Example 7
Source File: Express2EMF.java    From BIMserver with GNU Affero General Public License v3.0 5 votes vote down vote up
private void addInverseAttribute(Attribute attrib, EClass cls) {
	InverseAttribute inverseAttribute = (InverseAttribute) attrib;
	EReference eRef = eFactory.createEReference();
	eRef.setUnsettable(true); // Inverses are always optional?
	eRef.getEAnnotations().add(createInverseAnnotation());
	eRef.setName(attrib.getName());
	if (inverseAttribute.getMax_cardinality() != null) {
		IntegerBound max_cardinality = (IntegerBound) inverseAttribute.getMax_cardinality();
		if (max_cardinality.getBound_value() == -1) {
			eRef.setUpperBound(max_cardinality.getBound_value());
		} else {
			eRef.setUpperBound(max_cardinality.getBound_value() + 1);
		}
	}
	String type = (inverseAttribute).getDomain().getName();
	EClass classifier = (EClass) schemaPack.getEClassifier(type);
	eRef.setEType(classifier);
	String reverseName = inverseAttribute.getInverted_attr().getName();
	EReference reference = (EReference) classifier.getEStructuralFeature(reverseName);
	reference.getEAnnotations().add(createInverseAnnotation());
	if (eRef.getEType() == classifier && reference.getEType() == cls) {
		if (eRef.isMany()) {
			eRef.setUnique(true);
		}
		if (reference.isMany()) {
			reference.setUnique(true);
		}
		reference.setEOpposite(eRef);
		eRef.setEOpposite(reference);
	} else {
		System.out.println("Inverse mismatch");
		System.out.println(classifier.getName() + "." + reference.getName() + " => " + cls.getName() + "." + eRef.getName());
	}
	cls.getEStructuralFeatures().add(eRef);
}
 
Example 8
Source File: XtextGrammarRefactoringIntegrationTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testRefactorXtextGrammarWithGeneratedClassifierAndModelWithRefToClassifier() throws Exception {
	ResourceSet rs = resourceSetProvider.get();
	EcoreFactory eInstance = EcoreFactory.eINSTANCE;
	Resource ecoreModelResource = createEcoreModel(rs, ecoreURI, initialModelRoot);
	EClass greetingClass = getGreetingClass(ecoreModelResource);
	EReference greetingRefLocal = getReferenceoGreeting(ecoreModelResource, greetingClass);
	String greetingClassFragment = EcoreUtil.getURI(greetingClass).fragment();
	String greetingRefFragment = EcoreUtil.getURI(greetingRefLocal).fragment();

	EPackage refPackage = eInstance.createEPackage();
	refPackage.setName("myDsl2");
	refPackage.setNsPrefix("myDsl2");
	refPackage.setNsURI("http://testrefactoring2");
	EClass modelRefClass = eInstance.createEClass();
	refPackage.getEClassifiers().add(modelRefClass);
	modelRefClass.setName("ModelRef");
	EReference reference = eInstance.createEReference();
	reference.setName("ref");
	reference.setLowerBound(0);
	reference.setUpperBound(-1);
	reference.setEType(greetingClass);
	modelRefClass.getEStructuralFeatures().add(reference);
	Resource refToGreetingResource = createEcoreModel(rs,
			URI.createPlatformResourceURI(TEST_PROJECT + "/src/org/xtext/example/mydsl/" + "MyDsl2.ecore", true),
			refPackage);
	refToGreetingResource.unload();
	ecoreModelResource.unload();
	waitForBuild();
	waitForDisplay();
	XtextEditor editor = openEditor(grammarFile);
	doRefactoring(editor);
	waitForBuild();
	checkConsistenceOfGrammar(editor);
	ecoreModelResource.load(null);
	String renamedGreetingClassFragment = greetingClassFragment.replaceFirst(CLASSIFIERNAME, REFACTOREDCLASSIFIERNAME);
	EObject renamedGreetingClass = ecoreModelResource.getEObject(renamedGreetingClassFragment);
	assertNotNull(renamedGreetingClass);
	assertEquals(REFACTOREDCLASSIFIERNAME, SimpleAttributeResolver.NAME_RESOLVER.apply(renamedGreetingClass));
	EReference greetingReference = (EReference) ecoreModelResource.getEObject(greetingRefFragment);
	EClassifier eType = greetingReference.getEType();
	assertFalse(eType.eIsProxy());
	assertEquals(REFACTOREDCLASSIFIERNAME, eType.getName());

	refToGreetingResource.load(null);
	EReference externalReferenceToGreeting = getReferenceoGreeting(refToGreetingResource, eType);
	assertFalse(externalReferenceToGreeting.getEType().eIsProxy());
	assertEquals(REFACTOREDCLASSIFIERNAME, externalReferenceToGreeting.getEType().getName());

}
 
Example 9
Source File: AbstractLiveContainerTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
private EReference createRefToRoot() {
	EReference ref = EcoreFactory.eINSTANCE.createEReference();
	EcoreFactory.eINSTANCE.createEClass().getEStructuralFeatures().add(ref);
	ref.setEType(getModelRootType());
	return ref;
}
 
Example 10
Source File: DefaultReferenceDescriptionTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Test public void testSpecialReferences() {
	EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
	ePackage.setName("test");
	ePackage.setNsPrefix("test");
	ePackage.setNsURI("test");

	EClass eClass = EcoreFactory.eINSTANCE.createEClass();
	eClass.setName("Test");
	eClass.getESuperTypes().add(EcorePackage.Literals.EPACKAGE);
	ePackage.getEClassifiers().add(eClass);

	EReference eReference1 = EcoreFactory.eINSTANCE.createEReference();
	eReference1.setContainment(false);
	eReference1.setName("onlyExportedRef");
	eReference1.setEType(EcorePackage.Literals.EPACKAGE);
	eClass.getEStructuralFeatures().add(eReference1);

	EReference eReference2 = EcoreFactory.eINSTANCE.createEReference();
	eReference2.setContainment(true);
	eReference2.setName("containmentRef");
	eReference2.setEType(EcorePackage.Literals.EPACKAGE);
	eClass.getEStructuralFeatures().add(eReference2);

	EReference eReference3 = EcoreFactory.eINSTANCE.createEReference();
	eReference3.setContainment(false);
	eReference3.setTransient(true);
	eReference3.setName("transientRef");
	eReference3.setEType(EcorePackage.Literals.EPACKAGE);
	eClass.getEStructuralFeatures().add(eReference3);

	EReference eReference4 = EcoreFactory.eINSTANCE.createEReference();
	eReference4.setContainment(false);
	eReference4.setVolatile(true);
	eReference4.setName("volatileRef");
	eReference4.setEType(EcorePackage.Literals.EPACKAGE);
	eClass.getEStructuralFeatures().add(eReference4);

	EReference eReference5 = EcoreFactory.eINSTANCE.createEReference();
	eReference5.setContainment(false);
	eReference5.setDerived(true);
	eReference5.setName("derivedRef");
	eReference5.setEType(EcorePackage.Literals.EPACKAGE);
	eClass.getEStructuralFeatures().add(eReference5);

	EObject object = ePackage.getEFactoryInstance().create(eClass);
	object.eSet(EcorePackage.Literals.ENAMED_ELEMENT__NAME, "testname");
	object.eSet(eReference1, EcorePackage.eINSTANCE);
	object.eSet(eReference2, ePackage.getEFactoryInstance().create(eClass));
	object.eSet(eReference3, EcorePackage.eINSTANCE);
	object.eSet(eReference4, EcorePackage.eINSTANCE);
	object.eSet(eReference5, EcorePackage.eINSTANCE);

	Resource testResource = new XMIResourceImpl(URI.createPlatformResourceURI("test.ecore", true));
	testResource.getContents().add(object);
	IResourceDescription resourceDescription = createResourceDescription(testResource);
	assertEquals("Only one external reference expected", 1, size(resourceDescription.getReferenceDescriptions()));
	IReferenceDescription referenceDescription = resourceDescription.getReferenceDescriptions().iterator().next();
	assertEquals(-1, referenceDescription.getIndexInList());
	assertEquals(EcoreUtil.getURI(object), referenceDescription.getSourceEObjectUri());
	assertEquals(eReference1, referenceDescription.getEReference());
	assertEquals(EcoreUtil.getURI(EcorePackage.eINSTANCE), referenceDescription.getTargetEObjectUri());
	assertEquals(EcoreUtil.getURI(object), referenceDescription.getContainerEObjectURI());
}
 
Example 11
Source File: DefaultReferenceDescriptionTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Test public void testCrossResourceContainment() {
	EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
	ePackage.setName("test");
	ePackage.setNsPrefix("test");
	ePackage.setNsURI("test");

	EClass eClass = EcoreFactory.eINSTANCE.createEClass();
	eClass.setName("Test");
	ePackage.getEClassifiers().add(eClass);
	
	EAttribute nameAttribute = EcoreFactory.eINSTANCE.createEAttribute();
	nameAttribute.setName("name");
	nameAttribute.setID(true);
	nameAttribute.setEType(EcorePackage.Literals.ESTRING);
	eClass.getEStructuralFeatures().add(nameAttribute);

	EReference containmentRef = EcoreFactory.eINSTANCE.createEReference();
	containmentRef.setContainment(true);
	containmentRef.setName("crossResourceContainment");
	containmentRef.setEType(eClass);
	containmentRef.setResolveProxies(true);
	eClass.getEStructuralFeatures().add(containmentRef);
	
	EReference containerRef = EcoreFactory.eINSTANCE.createEReference();
	containerRef.setName("containerRef");
	containerRef.setEType(eClass);
	containerRef.setResolveProxies(true);
	containerRef.setEOpposite(containmentRef);
	containmentRef.setEOpposite(containerRef);
	eClass.getEStructuralFeatures().add(containerRef);

	EObject container = ePackage.getEFactoryInstance().create(eClass);
	EObject child = ePackage.getEFactoryInstance().create(eClass);
	
	Resource containerResource = new XMIResourceImpl(URI.createPlatformResourceURI("container.ecore", true));
	Resource childResource = new XMIResourceImpl(URI.createPlatformResourceURI("child.ecore", true));
	ResourceSet resourceSet = new ResourceSetImpl();
	resourceSet.getResources().add(containerResource);
	resourceSet.getResources().add(childResource);
	
	containerResource.getContents().add(container);
	childResource.getContents().add(child);
	
	container.eSet(containmentRef, child);
	assertTrue(container.eResource() != child.eResource());
	
	{ 
		IResourceDescription containerDescription = createResourceDescription(containerResource);
		IReferenceDescription onlyContainerElement = Iterables.getOnlyElement(containerDescription.getReferenceDescriptions());
		assertEquals(-1, onlyContainerElement.getIndexInList());
		assertEquals(EcoreUtil.getURI(container), onlyContainerElement.getSourceEObjectUri());
		assertEquals(containmentRef, onlyContainerElement.getEReference());
		assertEquals(EcoreUtil.getURI(child), onlyContainerElement.getTargetEObjectUri());
	}
	{
		IResourceDescription childDescription = createResourceDescription(childResource);
		IReferenceDescription onlyChildElement = Iterables.getOnlyElement(childDescription.getReferenceDescriptions());
		assertEquals(-1, onlyChildElement.getIndexInList());
		assertEquals(EcoreUtil.getURI(child), onlyChildElement.getSourceEObjectUri());
		assertEquals(containerRef, onlyChildElement.getEReference());
		assertEquals(EcoreUtil.getURI(container), onlyChildElement.getTargetEObjectUri());
	}
}
 
Example 12
Source File: Express2EMF.java    From BIMserver with GNU Affero General Public License v3.0 4 votes vote down vote up
private void doRealDerivedAttributes() {
	for (EntityDefinition entityDefinition : schema.getEntities()) {
		for (DerivedAttribute2 attributeName : entityDefinition.getDerivedAttributes().values()) {
			EClass eClass = (EClass) schemaPack.getEClassifier(entityDefinition.getName());
			// EStructuralFeature derivedAttribute =
			// eFactory.createEReference();
			if (attributeName.getType() != null && !attributeName.hasSuper()) {
				// if (attributeName.getType() instanceof EntityDefinition)
				// {
				// derivedAttribute.setEType(schemaPack.getEClassifier(((EntityDefinition)
				// attributeName.getType()).getName()));
				// } else if (attributeName.getType() instanceof
				// IntegerType) {
				// derivedAttribute.setEType(schemaPack.getEClassifier("IfcInteger"));
				// } else if (attributeName.getType() instanceof RealType) {
				// derivedAttribute.setEType(schemaPack.getEClassifier("IfcReal"));
				// } else if (attributeName.getType() instanceof
				// LogicalType) {
				// derivedAttribute.setEType(schemaPack.getEClassifier("IfcLogical"));
				if (attributeName.getType() instanceof DefinedType) {
					EClassifier eType = schemaPack.getEClassifier(((DefinedType) attributeName.getType()).getName());
					boolean found = false;
					for (EClass eSuperType : eClass.getEAllSuperTypes()) {
						if (eSuperType.getEStructuralFeature(attributeName.getName()) != null) {
							found = true;
							break;
						}
					}
					if (eType.getEAnnotation("wrapped") != null) {
						if (!found) {
							EAttribute eAttribute = eFactory.createEAttribute();
							eAttribute.setDerived(true);
							eAttribute.setName(attributeName.getName());
							if (eAttribute.getName().equals("RefLatitude") || eAttribute.getName().equals("RefLongitude")) {
								eAttribute.setUpperBound(3);
								eAttribute.setUnique(false);
							}
							EClassifier type = ((EClass) eType).getEStructuralFeature("wrappedValue").getEType();
							eAttribute.setEType(type);
							eAttribute.setUnsettable(true); // TODO find out
															// if its
															// optional
							eClass.getEStructuralFeatures().add(eAttribute);
							if (type == EcorePackage.eINSTANCE.getEDouble()) {
								EAttribute doubleStringAttribute = eFactory.createEAttribute();
								doubleStringAttribute.setName(attributeName.getName() + "AsString");
								doubleStringAttribute.getEAnnotations().add(createAsStringAnnotation());
								doubleStringAttribute.getEAnnotations().add(createHiddenAnnotation());
								doubleStringAttribute.setUnsettable(true); // TODO
																			// find
																			// out
																			// if
																			// its
																			// optional
								doubleStringAttribute.setEType(EcorePackage.eINSTANCE.getEString());
								eClass.getEStructuralFeatures().add(doubleStringAttribute);
							}
						}
					} else {
						if (!found) {
							EReference eReference = eFactory.createEReference();
							eReference.setName(attributeName.getName());
							eReference.setDerived(true);
							eReference.setUnsettable(true);
							eReference.setEType(eType);
							eClass.getEStructuralFeatures().add(eReference);
						}
					}
					// derivedAttribute.setEType(eType);
				}
			}
			// derivedAttribute.setName(attributeName.getName());
			// derivedAttribute.setDerived(true);
			// derivedAttribute.setTransient(true);
			// derivedAttribute.setVolatile(true);
			// if (attributeName.isCollection()) {
			// derivedAttribute.setUpperBound(-1);
			// }
			// EAnnotation annotation = eFactory.createEAnnotation();
			// annotation.setSource("http://www.iso.org/iso10303-11/EXPRESS");
			// annotation.getDetails().put("code",
			// attributeName.getExpressCode());
			// derivedAttribute.getEAnnotations().add(annotation);
			// if (eClass.getEStructuralFeature(derivedAttribute.getName())
			// == null) {
			// eClass.getEStructuralFeatures().add(derivedAttribute);
			// }
		}
	}
}
 
Example 13
Source File: Express2EMF.java    From BIMserver with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addTwoDimensionalArray(String entityName, String attribName) {
	EClassifier finalType = null;
	if (entityName.equals("IfcBSplineSurface") && attribName.equals("ControlPointsList")) {
		finalType = schemaPack.getEClassifier("IfcCartesianPoint");
	} else if (entityName.equals("IfcCartesianPointList3D") && attribName.equals("CoordList")) {
		finalType = schemaPack.getEClassifier("IfcLengthMeasure");
	} else if (entityName.equals("IfcColourRgbList") && attribName.equals("ColourList")) {
		finalType = schemaPack.getEClassifier("IfcNormalisedRatioMeasure");
	} else if (entityName.equals("IfcIndexedTriangleTextureMap") && attribName.equals("TexCoordIndex")) {
		finalType = EcorePackage.eINSTANCE.getELong();
	} else if (entityName.equals("IfcRationalBSplineSurfaceWithKnots") && attribName.equals("WeightsData")) {
		finalType = EcorePackage.eINSTANCE.getEDouble();
	} else if (entityName.equals("IfcStructuralLoadConfiguration") && attribName.equals("Locations")) {
		finalType = schemaPack.getEClassifier("IfcLengthMeasure");
	} else if (entityName.equals("IfcTessellatedFaceSet") && attribName.equals("Normals")) {
		finalType = schemaPack.getEClassifier("IfcParameterValue");
	} else if (entityName.equals("IfcTextureVertexList") && attribName.equals("TexCoordsList")) {
		finalType = schemaPack.getEClassifier("IfcParameterValue");
	} else if (entityName.equals("IfcTriangulatedFaceSet") && attribName.equals("CoordIndex")) {
		finalType = EcorePackage.eINSTANCE.getELong();
	} else if (entityName.equals("IfcCartesianPointList2D") && attribName.equals("CoordList")) {
		finalType = schemaPack.getEClassifier("IfcLengthMeasure");
	} else if (entityName.equals("IfcIndexedPolygonalFaceWithVoids") && attribName.equals("InnerCoordIndices")) {
		finalType = EcorePackage.eINSTANCE.getELong();
	} else if (entityName.equals("IfcTriangulatedFaceSet") && attribName.equals("Normals")) {
		finalType = schemaPack.getEClassifier("IfcParameterValue");
	} else if (entityName.equals("IfcTriangulatedFaceSet") && attribName.equals("NormalIndex")) {
		finalType = EcorePackage.eINSTANCE.getELong();
	} else {
		throw new RuntimeException("Unimplemented " + entityName + "." + attribName);
	}
	EClass containerClass = (EClass) schemaPack.getEClassifier("ListOf" + finalType.getName());
	if (containerClass == null) {
		containerClass = EcoreFactory.eINSTANCE.createEClass();
		containerClass.setName("ListOf" + finalType.getName());

		if (finalType.getEPackage() == EcorePackage.eINSTANCE) {
			EAttribute finalAttribute = EcoreFactory.eINSTANCE.createEAttribute();
			finalAttribute.setName("List");
			finalAttribute.setEType(finalType);
			finalAttribute.setUpperBound(-1);
			containerClass.getEAttributes().add(finalAttribute);
			
			if (finalType == EcorePackage.eINSTANCE.getEDouble()) {
				EAttribute stringAttribute = EcoreFactory.eINSTANCE.createEAttribute();
				stringAttribute.setName("ListAsString");
				stringAttribute.setEType(EcorePackage.eINSTANCE.getEString());
				stringAttribute.setUpperBound(-1);
				containerClass.getEAttributes().add(stringAttribute);
			}
		} else {
			EReference finalReference = EcoreFactory.eINSTANCE.createEReference();
			finalReference.setName("List");
			finalReference.setEType(finalType);
			finalReference.setUpperBound(-1);
			containerClass.getEReferences().add(finalReference);
		}

		schemaPack.getEClassifiers().add(containerClass);
	}
	
	EReference eReference = EcoreFactory.eINSTANCE.createEReference();
	eReference.getEAnnotations().add(createTwoDimensionalArrayAnnotation());
	eReference.setName(attribName);
	eReference.setUpperBound(-1);
	eReference.setEType(containerClass);
	
	EClass cls = (EClass) schemaPack.getEClassifier(entityName);
	cls.getEStructuralFeatures().add(eReference);
}