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: 33136
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


Ed Merks
Professional Support: https://www.macromodeling.com/
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 Apr 19 00:19:11 GMT 2024

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

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

Back to the top