Setting a multi-valued tagged value [message #1858709] |
Mon, 17 April 2023 13:42 |
Yves BERNARD Messages: 174 Registered: July 2014 |
Senior Member |
|
|
I'm struggling in setting tagged values of stereotypes with collections of values.
Reading such tagged values works fine by using the EMF getValue utility like this:
mv: Bag(OclAny) = element.getValue(element.getAppliedStereotype("MyStereotypeQualifiedName"), "myMVTaggedValue")->asBag();
However, using setValue in a similar way does not works:
mv: Bag(OclAny) = Bag{1, 2, 3};
element.setValue(element.getAppliedStereotype("MyStereotypeQualifiedName"), "myMVTaggedValue", mv);
Here is the kind of error message I get:
org.eclipse.m2m.atl.emftvm.util.VMException: java.lang.IllegalArgumentException: [org.eclipse.emf.ecore.impl.DynamicEObjectImpl@44e0e3bd (eClass: org.eclipse.emf.ecore.impl.EClassImpl@615dc3b8 (name: MyClass) (instanceClassName: null) (abstract: false, interface: false))]
at public abstract void org.eclipse.uml2.uml.Element.setValue(org.eclipse.uml2.uml.Stereotype,java.lang.String,java.lang.Object)
Not that "setValue" works fine with mono-valued tagged values.
Yves
|
|
|
|
|
Re: Setting a multi-valued tagged value [message #1858744 is a reply to message #1858733] |
Wed, 19 April 2023 06:35 |
Yves BERNARD Messages: 174 Registered: July 2014 |
Senior Member |
|
|
Thanks for your reply.
I actually started with a Sequence but I got the same error. That's the reason why I tried with something more "generic" (i.e. Bag).
That said, I just tried this morning to set the tagged value with an empty Sequence and it works, actually. So I understand that the issue does not come from the collection itself (even if I probably have to use a Sequence) but from its content that could not be of the expected type (e.g. because it would not have been properly transformed).
Yves
|
|
|
Powered by
FUDForum. Page generated in 0.04825 seconds