Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » ExtendedMetaData and inheritance
ExtendedMetaData and inheritance [message #425647] Wed, 03 December 2008 17:20 Go to next message
Eclipse UserFriend
Originally posted by: jbarkanic.gmail.com

I'm using a simple ExtendedMetaData 'name' on some of my
multiplicity-many attributes, so that the serialization uses the more
natural singular name instead of the plural. So you get something like this:

<child name="one"/>
<child name="two"/>

instead of

<children name="one"/>
<children name="two"/>

It works fine, except for those attributes that are part of an abstract
superclass. For example:

abstract ClassA{
List children
}

ClassB extends ClassA{
String someAttribute
}

I've annotated children with an ExtendedMetaData, but I still get
something like this:

<ClassB someAttribute="text">
<children name="one"/>
<children name="two"/>
</ClassB>

Have I overlooked something, or am I just out of luck trying to use this
ExtendedMetaData annotation on the attributes of abstract classes?

-Jason
Re: ExtendedMetaData and inheritance [message #425651 is a reply to message #425647] Wed, 03 December 2008 17:47 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30916
Registered: July 2009
Senior Member
Jason,

Comments below.


JBarkanich wrote:
> I'm using a simple ExtendedMetaData 'name' on some of my
> multiplicity-many attributes, so that the serialization uses the more
> natural singular name instead of the plural. So you get something like
> this:
>
> <child name="one"/>
> <child name="two"/>
>
> instead of
>
> <children name="one"/>
> <children name="two"/>
>
> It works fine, except for those attributes that are part of an
> abstract superclass. For example:
>
> abstract ClassA{
> List children
> }
>
> ClassB extends ClassA{
> String someAttribute
> }
>
> I've annotated children with an ExtendedMetaData, but I still get
> something like this:
>
> <ClassB someAttribute="text">
> <children name="one"/>
> <children name="two"/>
> </ClassB>
>
> Have I overlooked something, or am I just out of luck trying to use
> this ExtendedMetaData annotation on the attributes of abstract classes?
It should work the same way. When B is serialized, it's the children
feature of A that's being used so whether you serialize an A or a B they
same effect should occur.
>
> -Jason
Re: ExtendedMetaData and inheritance [message #425721 is a reply to message #425651] Fri, 05 December 2008 14:50 Go to previous message
Eclipse UserFriend
Originally posted by: jbarkanic.gmail.com

Thanks Ed,

I assumed it should work the way you described. My mistake was a
silly one. I had the annotation source as 'ExtendedMetaData' instead of
'http:///org/eclipse/emf/ecore/util/ExtendedMetaData'. I didn't notice
it right away since they display identically in the editor.

-Jason

Ed Merks wrote:
> Jason,
>
> Comments below.
>
>
> JBarkanich wrote:
>> I'm using a simple ExtendedMetaData 'name' on some of my
>> multiplicity-many attributes, so that the serialization uses the more
>> natural singular name instead of the plural. So you get something like
>> this:
>>
>> <child name="one"/>
>> <child name="two"/>
>>
>> instead of
>>
>> <children name="one"/>
>> <children name="two"/>
>>
>> It works fine, except for those attributes that are part of an
>> abstract superclass. For example:
>>
>> abstract ClassA{
>> List children
>> }
>>
>> ClassB extends ClassA{
>> String someAttribute
>> }
>>
>> I've annotated children with an ExtendedMetaData, but I still get
>> something like this:
>>
>> <ClassB someAttribute="text">
>> <children name="one"/>
>> <children name="two"/>
>> </ClassB>
>>
>> Have I overlooked something, or am I just out of luck trying to use
>> this ExtendedMetaData annotation on the attributes of abstract classes?
> It should work the same way. When B is serialized, it's the children
> feature of A that's being used so whether you serialize an A or a B they
> same effect should occur.
>>
>> -Jason
Previous Topic:Number format exception in genrated editor for feature with ExtendetMetaData
Next Topic:XSD to Java code generation with multiple import of the same namespace
Goto Forum:
  


Current Time: Fri Feb 28 19:39:33 GMT 2020

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

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

Back to the top