Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How can access eStructuralFeatures any of EClassifier?
How can access eStructuralFeatures any of EClassifier? [message #1757963] Wed, 22 March 2017 10:54 Go to next message
Ömer Faruk Alaca is currently offline Ömer Faruk AlacaFriend
Messages: 1
Registered: March 2017
Junior Member
Hi everyone,

I just started about EMF. I'm trying to write a java code that reads ecore files and using the EMF API. My problem is that, i can access all epackage and eclassifier tags but i cannot access all EStructuralFeatures any of EClassifier.

My code is as follow,

private static void evaluateEcore(String absolutePath) {

		URI fileURI = URI.createFileURI(absolutePath);
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl ());
					
		ResourceSet resourceSet = new ResourceSetImpl(); 
		Resource resource = resourceSet.getResource(fileURI, true);
		EPackage ePackage = (EPackage)resource.getContents().get(0);
		System.out.println(ePackage.getName());
		System.out.println(ePackage.getNsURI());
		System.out.println(ePackage.getNsPrefix());
		EList<EClassifier> eClassifierList = ePackage.getEClassifiers();
		for(EClassifier eClassifier : eClassifierList)
		{
			System.out.println("\t"+eClassifier.getName());
			//EStructuralFeature eaList = eClassifier.eContainingFeature();			
			//EList<EReference> allEStructFeats = eClassifier.eContainer();
			//for(EObject esf : allEStructFeats)
			//{
			//	System.out.println("\t\t"+esf.toString());
				//System.out.println("\t\t"+esf.getEType());
			//}
		}
		
	}


I'd be happy if you help. ty
Re: How can access eStructuralFeatures any of EClassifier? [message #1757987 is a reply to message #1757963] Wed, 22 March 2017 14:42 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29393
Registered: July 2009
Senior Member
It seems to me that a little bit of investigation on your part would quickly reveal that of course EClassifier doesn't have a method to return EStrucutralFeatures and that EClassifier has several subclasses, including EClass, which does have a method getEAllStructuralFeatures().
Previous Topic:EMF notification missing for removeAll on reference which is part of a FeatureMap
Next Topic:generation of ID to identify EMF element (without modifying the name based referencing mechanism)
Goto Forum:
  


Current Time: Sun Jun 24 13:22:18 GMT 2018

Powered by FUDForum. Page generated in 0.02327 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top