Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » inheritance from own defined EDataType
inheritance from own defined EDataType [message #631360] Thu, 07 October 2010 08:54 Go to next message
Martin Jacob is currently offline Martin JacobFriend
Messages: 191
Registered: July 2009
Senior Member
Hi,

I try to define a inheritance in class A from class B. Class B is a EDataType by my self.
See the class B from the ecore sniped
<eClassifiers xsi:type="ecore:EDataType" name="DefaultClient"
instanceClassName="de.bahntechnik.dd.util.net.http.DefaultClient "
serializable="false"/>
<eClassifiers xsi:type="ecore:EClass" name="OtClientIf"/>

Unfortunately I am not able to define a inheritance in class A from class B. I am using the ecore
diagram to design my model.

Is it not possible to do such kind of inheritance or what do I wrong?

BR, Martin
Re: inheritance from own defined EDataType [message #631368 is a reply to message #631360] Thu, 07 October 2010 09:46 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Martin,

I fear it's only possible to define inheritance between EClasses.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 07.10.2010 10:54, schrieb Martin Jacob:
> Hi,
>
> I try to define a inheritance in class A from class B. Class B is a EDataType by my self.
> See the class B from the ecore sniped
> <eClassifiers xsi:type="ecore:EDataType" name="DefaultClient" instanceClassName="de.bahntechnik.dd.util.net.http.DefaultClient "
> serializable="false"/>
> <eClassifiers xsi:type="ecore:EClass" name="OtClientIf"/>
>
> Unfortunately I am not able to define a inheritance in class A from class B. I am using the ecore diagram to design my model.
>
> Is it not possible to do such kind of inheritance or what do I wrong?
>
> BR, Martin
>


Re: inheritance from own defined EDataType [message #631387 is a reply to message #631368] Thu, 07 October 2010 10:59 Go to previous messageGo to next message
Martin Jacob is currently offline Martin JacobFriend
Messages: 191
Registered: July 2009
Senior Member
Hi Eike,

thanks for the hint. I defined an EClass as follows:
<eClassifiers xsi:type="ecore:EClass" name="DefaultClient"
instanceClassName="de.bahntechnik.dd.util.net.http.DefaultClient "/>

Now I can use this EClass for inheritance but the generated code implements and not extends the
EClass from above:

public class DefaultClientImpl extends EObjectImpl implements DefaultClient {
....
}

How can I generate the code that DefaultClientImpl extends DefaultClient?

Martin

Eike Stepper wrote, On 07.10.2010 11:46:
> Hi Martin,
>
> I fear it's only possible to define inheritance between EClasses.
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
> Am 07.10.2010 10:54, schrieb Martin Jacob:
>> Hi,
>>
>> I try to define a inheritance in class A from class B. Class B is a EDataType by my self.
>> See the class B from the ecore sniped
>> <eClassifiers xsi:type="ecore:EDataType" name="DefaultClient"
>> instanceClassName="de.bahntechnik.dd.util.net.http.DefaultClient "
>> serializable="false"/>
>> <eClassifiers xsi:type="ecore:EClass" name="OtClientIf"/>
>>
>> Unfortunately I am not able to define a inheritance in class A from class B. I am using the ecore
>> diagram to design my model.
>>
>> Is it not possible to do such kind of inheritance or what do I wrong?
>>
>> BR, Martin
>>
Re: inheritance from own defined EDataType [message #631388 is a reply to message #631387] Thu, 07 October 2010 11:25 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 07.10.2010 12:59, schrieb Martin Jacob:
> Hi Eike,
>
> thanks for the hint. I defined an EClass as follows:
> <eClassifiers xsi:type="ecore:EClass" name="DefaultClient" instanceClassName="de.bahntechnik.dd.util.net.http.DefaultClient "/>
>
> Now I can use this EClass for inheritance but the generated code implements and not extends the EClass from above:
>
> public class DefaultClientImpl extends EObjectImpl implements DefaultClient {
> ....
> }
>
> How can I generate the code that DefaultClientImpl extends DefaultClient?

I have no experience with EClasses who's objects are not instances of EObjectImpl ;-(

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
> Martin
>
> Eike Stepper wrote, On 07.10.2010 11:46:
>> Hi Martin,
>>
>> I fear it's only possible to define inheritance between EClasses.
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>
>> Am 07.10.2010 10:54, schrieb Martin Jacob:
>>> Hi,
>>>
>>> I try to define a inheritance in class A from class B. Class B is a EDataType by my self.
>>> See the class B from the ecore sniped
>>> <eClassifiers xsi:type="ecore:EDataType" name="DefaultClient"
>>> instanceClassName="de.bahntechnik.dd.util.net.http.DefaultClient "
>>> serializable="false"/>
>>> <eClassifiers xsi:type="ecore:EClass" name="OtClientIf"/>
>>>
>>> Unfortunately I am not able to define a inheritance in class A from class B. I am using the ecore
>>> diagram to design my model.
>>>
>>> Is it not possible to do such kind of inheritance or what do I wrong?
>>>
>>> BR, Martin
>>>


Re: inheritance from own defined EDataType [message #631435 is a reply to message #631387] Thu, 07 October 2010 13:54 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Martin,

You should set abstract and interface to true on that EClass.


Martin Jacob wrote:
> Hi Eike,
>
> thanks for the hint. I defined an EClass as follows:
> <eClassifiers xsi:type="ecore:EClass" name="DefaultClient"
> instanceClassName="de.bahntechnik.dd.util.net.http.DefaultClient "/>
>
> Now I can use this EClass for inheritance but the generated code
> implements and not extends the EClass from above:
>
> public class DefaultClientImpl extends EObjectImpl implements
> DefaultClient {
> ...
> }
>
> How can I generate the code that DefaultClientImpl extends
> DefaultClient?
>
> Martin
>
> Eike Stepper wrote, On 07.10.2010 11:46:
>> Hi Martin,
>>
>> I fear it's only possible to define inheritance between EClasses.
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>
>> Am 07.10.2010 10:54, schrieb Martin Jacob:
>>> Hi,
>>>
>>> I try to define a inheritance in class A from class B. Class B is a
>>> EDataType by my self.
>>> See the class B from the ecore sniped
>>> <eClassifiers xsi:type="ecore:EDataType" name="DefaultClient"
>>> instanceClassName="de.bahntechnik.dd.util.net.http.DefaultClient "
>>> serializable="false"/>
>>> <eClassifiers xsi:type="ecore:EClass" name="OtClientIf"/>
>>>
>>> Unfortunately I am not able to define a inheritance in class A from
>>> class B. I am using the ecore
>>> diagram to design my model.
>>>
>>> Is it not possible to do such kind of inheritance or what do I wrong?
>>>
>>> BR, Martin
>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: inheritance from own defined EDataType [message #632204 is a reply to message #631435] Tue, 12 October 2010 05:58 Go to previous messageGo to next message
Martin Jacob is currently offline Martin JacobFriend
Messages: 191
Registered: July 2009
Senior Member
Hi Ed,

sorry for late reply but I was busy with other things.

I tried as u suggested and set the EClass to abstract and as interface:
<eClassifiers xsi:type="ecore:EClass" name="DefaultClient"
instanceClassName="de.bahntechnik.dd.util.net.http.DefaultClient "
abstract="true" interface="true"/>

From this class I derived class X:
<eClassifiers xsi:type="ecore:EClass" name="X" eSuperTypes="#//DefaultClient"/>

unfortunately the generated code was not able to compile. The problem is as follow in X.java:
public interface X extends EObject, DefaultClient: but DefaultClient is not a interface it is a class

Do u have any suggestion how to extend a existing class with a class in my ecore model?

Martin



Ed Merks wrote, On 07.10.2010 15:54:
> Martin,
>
> You should set abstract and interface to true on that EClass.
>
>
> Martin Jacob wrote:
>> Hi Eike,
>>
>> thanks for the hint. I defined an EClass as follows:
>> <eClassifiers xsi:type="ecore:EClass" name="DefaultClient"
>> instanceClassName="de.bahntechnik.dd.util.net.http.DefaultClient "/>
>>
>> Now I can use this EClass for inheritance but the generated code implements and not extends the
>> EClass from above:
>>
>> public class DefaultClientImpl extends EObjectImpl implements DefaultClient {
>> ...
>> }
>>
>> How can I generate the code that DefaultClientImpl extends DefaultClient?
>>
>> Martin
>>
>> Eike Stepper wrote, On 07.10.2010 11:46:
>>> Hi Martin,
>>>
>>> I fear it's only possible to define inheritance between EClasses.
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://www.esc-net.de
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>>
>>> Am 07.10.2010 10:54, schrieb Martin Jacob:
>>>> Hi,
>>>>
>>>> I try to define a inheritance in class A from class B. Class B is a EDataType by my self.
>>>> See the class B from the ecore sniped
>>>> <eClassifiers xsi:type="ecore:EDataType" name="DefaultClient"
>>>> instanceClassName="de.bahntechnik.dd.util.net.http.DefaultClient "
>>>> serializable="false"/>
>>>> <eClassifiers xsi:type="ecore:EClass" name="OtClientIf"/>
>>>>
>>>> Unfortunately I am not able to define a inheritance in class A from class B. I am using the ecore
>>>> diagram to design my model.
>>>>
>>>> Is it not possible to do such kind of inheritance or what do I wrong?
>>>>
>>>> BR, Martin
>>>>
Re: inheritance from own defined EDataType [message #632277 is a reply to message #632204] Tue, 12 October 2010 12:06 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Martin,

EClass instances must implement the EObject/InternalEObject interfaces
which they must do by extending some derivative of BasicEObjectImpl.
Therefore you can't just extend some existing plain old class.


Martin Jacob wrote:
> Hi Ed,
>
> sorry for late reply but I was busy with other things.
>
> I tried as u suggested and set the EClass to abstract and as interface:
> <eClassifiers xsi:type="ecore:EClass" name="DefaultClient"
> instanceClassName="de.bahntechnik.dd.util.net.http.DefaultClient "
> abstract="true" interface="true"/>
>
> From this class I derived class X:
> <eClassifiers xsi:type="ecore:EClass" name="X"
> eSuperTypes="#//DefaultClient"/>
>
> unfortunately the generated code was not able to compile. The problem
> is as follow in X.java:
> public interface X extends EObject, DefaultClient: but DefaultClient
> is not a interface it is a class
>
> Do u have any suggestion how to extend a existing class with a class
> in my ecore model?
>
> Martin
>
>
>
> Ed Merks wrote, On 07.10.2010 15:54:
>> Martin,
>>
>> You should set abstract and interface to true on that EClass.
>>
>>
>> Martin Jacob wrote:
>>> Hi Eike,
>>>
>>> thanks for the hint. I defined an EClass as follows:
>>> <eClassifiers xsi:type="ecore:EClass" name="DefaultClient"
>>> instanceClassName="de.bahntechnik.dd.util.net.http.DefaultClient "/>
>>>
>>> Now I can use this EClass for inheritance but the generated code
>>> implements and not extends the
>>> EClass from above:
>>>
>>> public class DefaultClientImpl extends EObjectImpl implements
>>> DefaultClient {
>>> ...
>>> }
>>>
>>> How can I generate the code that DefaultClientImpl extends
>>> DefaultClient?
>>>
>>> Martin
>>>
>>> Eike Stepper wrote, On 07.10.2010 11:46:
>>>> Hi Martin,
>>>>
>>>> I fear it's only possible to define inheritance between EClasses.
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://www.esc-net.de
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>>
>>>> Am 07.10.2010 10:54, schrieb Martin Jacob:
>>>>> Hi,
>>>>>
>>>>> I try to define a inheritance in class A from class B. Class B is
>>>>> a EDataType by my self.
>>>>> See the class B from the ecore sniped
>>>>> <eClassifiers xsi:type="ecore:EDataType" name="DefaultClient"
>>>>> instanceClassName="de.bahntechnik.dd.util.net.http.DefaultClient "
>>>>> serializable="false"/>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="OtClientIf"/>
>>>>>
>>>>> Unfortunately I am not able to define a inheritance in class A
>>>>> from class B. I am using the ecore
>>>>> diagram to design my model.
>>>>>
>>>>> Is it not possible to do such kind of inheritance or what do I wrong?
>>>>>
>>>>> BR, Martin
>>>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO]LastCommitTime can not be saved
Next Topic:Bidirectional reference
Goto Forum:
  


Current Time: Sat Apr 20 01:10:19 GMT 2024

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

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

Back to the top