Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2t-dev] Xtend

Hi Stefan,

please use the M2T newsgroup for such questions.

Some comments inline ...

1. I've tried to make a working example, which merges two models into one, but I didn't succeed. Could anybody point me to a working example?

I'm not aware of any examples. But it is fairly easy.
Pass two models to an extension and establish a link.
Something like this :

connect(Foo foo, Bar bar) :
foo.setBar(bar);

Not sure though if I understood your question. :-)

 
2. I've tried to understand, when you create a new model from one or more existing models, is it possible for the new model to memorize the mapping between new model's elements to the old elements of the source model(s).

The trace is handled implicitly. You can't access it.
This is the main difference between Xtend as an M2M and other M2M languages. The tracing and the identity preservation is done implicitly through the concept of 
"create"-extensions. See the documentation for details.

I've used Xtend for many years now and have never ever had the requirement to get access to the trace. I also have never heard that someone else needed it to solve any practical problem.

 
3. If I'm merging two models, which have similar elements (for example - one represented by XML and one - by java annotated classes, but describing similar elements) is it possible to describe through the means of Xtend, which element of some of the old models overrides the similar element in the other model?

Sure, you can inspect the model and make decisions based on that:

connect(Foo foo, Bar bar) :
if (bar.isXML())
foo.setBar(bar);

Again not sure if I understood the question...

 
4. Is it possible (relatively) easy to create a read/write model from read-only model(s)

You mean clone an existing model in order to modify it afterwards ?
EcoreUtil.clone(EObject) works pretty well.

 
I'll be glad to have some more detailed doc links and especially examples, which cover the above questions!

If you've installed the Xpand plugins, there'll be a reference documentation in Eclipse Help.
Did you find that?

Cheers,
Sven

Back to the top