Eclipse Modeling Framework (EMF) - Tutorial - Improvement hint

188 views
Skip to first unread message

Daniel

unread,
Apr 2, 2012, 11:03:00 AM4/2/12
to vogella
In http://www.vogella.de/articles/EclipseEMF/article.html

6. Using the model code

6.2. Example

The listing

import de.vogella.emf.webpage.model.webpage.impl.WebpagePackageImpl;

public class UsingEMFModel {
public static void main(String[] args) {
WebpagePackageImpl.init();


would be better with

import de.vogella.emf.webpage.model.webpage.WebpagePackage;

public class UsingEMFModel {
public static void main(String[] args) {
WebpagePackage.eINSTANCE;
or
WebpagePackage.eINSTANCE.eClass();

WebpagePackage.eINSTANCE does nothing else than calling
*.impl.WebpagePackageImpl.init();
But I think it's better, cause it's more about Separation of Concerns.

The Project with the model does not need to (must not) export the
generated *.impl-Package as it's set in the manifest.mf under Export-
Package:.

And the Plugin-Project using the model, shouldn't care about the
implementation. It even needn't to know, about its existence. The
Interfaces are sufficent and are everything to know about for usage.

Lars Vogel

unread,
Jul 20, 2014, 3:40:14 PM7/20/14
to vog...@googlegroups.com, dan...@rsmn.org
Sorry, this got (almost) lost in my inbox. I fixed that and the website should be updated in approx. 12 hours.

Best regards, Lars
--
You received this message because you are subscribed to the Google Groups "vogella" group.
To post to this group, send email to vog...@googlegroups.com.
To unsubscribe from this group, send email to vogella+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/vogella?hl=en.

Reply all
Reply to author
Forward
0 new messages