Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » update attributes of class programmatically
update attributes of class programmatically [message #1198446] Wed, 20 November 2013 10:25
Kostas Triantafyllidis is currently offline Kostas TriantafyllidisFriend
Messages: 15
Registered: November 2012
Junior Member
Hello all,

I am working in uml converting a model from xmi to uml-MARTE compatible. Of course this is done programmatically. I have already managed to create the model, the required classes and the operations that are inside the classes. The operations inside the classes are stereotyped with the "saStep" stereotype. I would like to update the values of some properties of this stereotype. I am trying to use the method setValue(Stereotype, "name_of_property", value), but this returns an exception.

//load subProfile SAM
Profile subprofile_SAM = diagram.getSubProfile(MARTE.getNestedPackage("MARTE_AnalysisModel"), "SAM");

Stereotype saStep = subprofile_SAM.getOwnedStereotype("SaStep");

org.eclipse.uml2.uml.Class new_class = diagram.createClass(swComponent.NameOfSWComponent);

for(int i=0; i<swComponent.SWComponent.size(); i++)
org.eclipse.uml2.uml.Operation tmp = diagram.createOwnedOperation(swComponent.SWComponent.get(i).OperationMetricsForAllPlatforms.get(0).NameOfOperation, new_class);

tmp.setValue(saStep, "L1CacheMiss", 1000);


The exception that i am receiving looks like this. Do you ave any idea why this is happening? I have to say that the property "L1CacheMiss" exists into the saStep stereotype and i can get its name by tmp.getAppliedStereotypes().get(0).getAllAttributes().get(cnt).getName();.

Exception in thread "main" java.lang.IllegalArgumentException: 1000
at org.eclipse.uml2.uml.internal.operations.ElementOperations.setValue(
at org.eclipse.uml2.uml.internal.impl.ElementImpl.setValue(
at loadPerformanceModels.files.main.create_OperationsClass(
at loadPerformanceModels.files.main.main(

Thank you in advance for you time,

[Updated on: Thu, 21 November 2013 15:34]

Report message to a moderator

Previous Topic:OCL expression
Next Topic:Error when with classifier reference in EnumerationLiterals
Goto Forum:

Current Time: Tue Aug 16 22:43:59 GMT 2022

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

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

Back to the top