Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Copying object properties
Copying object properties [message #1288368] Tue, 08 April 2014 13:59 Go to next message
Vlad Acretoaie is currently offline Vlad AcretoaieFriend
Messages: 95
Registered: April 2014
Member
In the following ETL rule the Source and Target models both conform to the OO.ecore metamodel found in org.eclipse.epsilon.examples.metamodels.

rule CopyAttribute
	transform source : Source!Attribute
	to target : Target!Attribute {
	
	target.name = source.name;
	target.visibility = source.visibility;
}


The "name" property is an instance of EString and is copied as expected. However, the "visibility" property is an instance of EEnumLiteral, and copying its value as shown above produces a ClassCastException. I don't understand why the two properties are treated differently.

I have also tried the following assignment:

target.visibility ::= source.visibility;


In this case, the value of target.visibility is always set to "public", regardless of the value of source.visibility.

In short, my question is: how can I copy the value of the "visibility" property to the target?
Re: Copying object properties [message #1288381 is a reply to message #1288368] Tue, 08 April 2014 14:09 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Vlad,

I'd suggest trying to load Source and Target models using the same URI-based metamodel.

Cheers,
Dimitris

[Updated on: Tue, 08 April 2014 14:09]

Report message to a moderator

Previous Topic:Handling Epsilon keywords as metamodel element names
Next Topic:Deep copy of model element
Goto Forum:
  


Current Time: Fri Apr 26 04:11:23 GMT 2024

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

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

Back to the top