Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Re: [UML2] programmatically set the type of a newly created Parameter???
Re: [UML2] programmatically set the type of a newly created Parameter??? [message #626119] Mon, 03 March 2008 18:27
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Jinhui,

This question is more appropriate for the UML2 newsgroup (copied).

To progammatically set the type of a parameter, simply call setType(Type),
passing the desired type as an argument.

Kenn

"Jinhui" <zhuj@in.tum.de> wrote in message
news:0cf126e1bb6a4f41a1a402583bbd8e00$1@www.eclipse.org...
> 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:dependency and allocation
Next Topic:Re: [UML2] programmatically set the type of a newly created Parameter???
Goto Forum:
  


Current Time: Thu Apr 25 05:50:52 GMT 2024

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

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

Back to the top