inheritance from own defined EDataType [message #631360] |
Thu, 07 October 2010 04:54  |
Eclipse User |
|
|
|
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 #632204 is a reply to message #631435] |
Tue, 12 October 2010 01:58   |
Eclipse User |
|
|
|
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 08:06  |
Eclipse User |
|
|
|
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
>>>>>
|
|
|
Powered by
FUDForum. Page generated in 0.04954 seconds