Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Why code shows class as interface
Why code shows class as interface [message #1232843] Fri, 17 January 2014 22:11 Go to next message
Byron Coughlin is currently offline Byron CoughlinFriend
Messages: 2
Registered: March 2011
Junior Member
I have created a simple model with a single class. Set abstract to false and interface to false. When I run the genmodel plugin for creating the model the java code creates the source of it being an interface.

* @see org.coughlin.grocerylist.grocerylist.GrocerylistPackage#getGrocerylist()
* @model interface="true" abstract="true"
* @generated
*/
public interface Grocerylist extends Activity {


Based on my model I would expect it to say

public class Grocerylist extends Activity {

I do not understand why it says it is an interface
Re: Why code shows class as interface [message #1233798 is a reply to message #1232843] Mon, 20 January 2014 14:07 Go to previous messageGo to next message
Byron Coughlin is currently offline Byron CoughlinFriend
Messages: 2
Registered: March 2011
Junior Member
As I am new to this forum not sure if this question belongs here. Thought it would be a relatively easy question that would get a quick response. If more information is needed let me know.

Thanks
Re: Why code shows class as interface [message #1233835 is a reply to message #1233798] Mon, 20 January 2014 15:57 Go to previous messageGo to next message
Cedric Moonen is currently offline Cedric MoonenFriend
Messages: 274
Registered: August 2009
Senior Member
Classes are generated in the impl package. By default EMF always generates an interface and a class for EClass defined in your model.

I think you can disable to behaviour and only generate classes by setting the option "Suppress Interfaces" in the genmodel. However, I don't really see a good reason to do that...
Re: Why code shows class as interface [message #1240923 is a reply to message #1233798] Fri, 07 February 2014 08:30 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30353
Registered: July 2009
Senior Member
Byron,

I've been away on vacation until today...

If you see

* @model interface="true" abstract="true"

in your generated model's interface, it must be the case that your Ecore
model for Grocerylist has those properties set that way.

As Cedric suggests, you should always expect to see both a generated
interface and a generated implementation class (unless you suppress that
behavior, which is not generally such a good idea and certainly won't
allow you to model multiple inheritance)...

On 20/01/2014 3:07 PM, Byron Coughlin wrote:
> As I am new to this forum not sure if this question belongs here.
> Thought it would be a relatively easy question that would get a quick
> response. If more information is needed let me know.
>
> Thanks
Previous Topic:assign value to model element automatically
Next Topic:Resolve platform:/resources outside the platform
Goto Forum:
  


Current Time: Wed Aug 21 12:14:26 GMT 2019

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

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

Back to the top