Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MDT (Model Development Tools) » [UML2] programmatically set the type of a newly created Parameter???
[UML2] programmatically set the type of a newly created Parameter??? [message #584759] Mon, 03 March 2008 11:41
Jinhui is currently offline Jinhui
Messages: 42
Registered: July 2009
Member
Hello everyone,

I have a questions:
I've programmatically created a Parameter, and how can I set the type of
it to Integer?

I've tried as following:
1 Parameter p = UMLFactory.eINSTANCE.createParameter();
2 p.setDirection(ParameterDirectionKind.RETURN_LITERAL);
3 p.setUpper(1);
4 p.setLower(1);
5 LiteralInteger li = UMLFactory.eINSTANCE.createLiteralInteger();
6 li.setValue(3);
7 System.out.println("type" + li.getType().toString());
8 p.setType(li.getType());
9 return p;

but at line 7, the type of "li" is still null??

so how to set the type of a Parameter to a primitive tpye, such as Integer
or String or boolean?

regards
Jinhui
Previous Topic:[Announce] Eclipse/OMG Symposium at EclipseCon 2008
Next Topic:[UML2] how to load UML_PRIMITIVE_TYPES_LIBRARY
Goto Forum:
  


Current Time: Wed Aug 27 07:16:18 EDT 2014

Powered by FUDForum. Page generated in 0.02414 seconds