Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » PrimitiveType
PrimitiveType [message #907997] Tue, 04 September 2012 14:20 Go to next message
Florian Wartenberg is currently offline Florian WartenbergFriend
Messages: 25
Registered: July 2012
Junior Member
Hi I want to create a new property inside a class which has the type Integer. I use this construct: modelClass.createOwnedAttribute(String arg0, Type arg1, EClass arg2).
Can anyone post an example how to create a property with this construct I cant resolve type.

regards

Florian
Re: PrimitiveType [message #908170 is a reply to message #907997] Tue, 04 September 2012 21:33 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
On 04/09/2012 15:20, Florian Wartenberg wrote:
> Hi I want to create a new property inside a class which has the type
> Integer. I use this construct: modelClass.createOwnedAttribute(String
> arg0, Type arg1, EClass arg2).
> Can anyone post an example how to create a property with this
> construct I cant resolve type.
>
> regards
>
> Florian
Have you looked at the Getting started with UML2 tutorial?

Regards

Ed Willink
Re: PrimitiveType [message #908239 is a reply to message #907997] Wed, 05 September 2012 01:59 Go to previous messageGo to next message
Florian Wartenberg is currently offline Florian WartenbergFriend
Messages: 25
Registered: July 2012
Junior Member
Of course I did apparently it does not say anything about the Integer primitive type. As asked before in another topic I have some difficulties in finding out how to resolve some expected arguments as Type for example.
Re: PrimitiveType [message #908283 is a reply to message #908239] Wed, 05 September 2012 04:49 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Since you're earlier reply was

"Works like a charm thank you so much!!! "

I assumed that you now understood how to call UML Java functions. The
getting started tutorial has an example of createOwnedAttribute so I'm
unclear what your problem is.

Try posting your best attempt.

Regards

Ed Willink

On 05/09/2012 02:59, Florian Wartenberg wrote:
> Of course I did apparently it does not say anything about the Integer
> primitive type. As asked before in another topic I have some
> difficulties in finding out how to resolve some expected arguments as
> Type for example.
Re: PrimitiveType [message #908568 is a reply to message #908283] Wed, 05 September 2012 15:20 Go to previous messageGo to next message
Florian Wartenberg is currently offline Florian WartenbergFriend
Messages: 25
Registered: July 2012
Junior Member
Property duration = modelClass.createOwnedAttribute("duration", modelClass.getPackage().getOwnedType("int"), UMLPackage.Literals.PROPERTY);

This creates the property but without a Type I do not now how to resolve it properly as stated before.

regards

Florian
Re: PrimitiveType [message #908574 is a reply to message #908568] Wed, 05 September 2012 15:32 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Does your modelClass.getPackage() have an "int" type?

If not perhaps you want to "Integer" from the UML Types package.

Regards

Ed Willink



On 05/09/2012 16:20, Florian Wartenberg wrote:
> Property duration = modelClass.createOwnedAttribute("duration",
> modelClass.getPackage().getOwnedType("int"),
> UMLPackage.Literals.PROPERTY);
>
> This creates the property but without a Type I do not now how to
> resolve it properly as stated before.
>
> regards
>
> Florian
Re: PrimitiveType [message #908621 is a reply to message #908574] Wed, 05 September 2012 17:03 Go to previous messageGo to next message
Florian Wartenberg is currently offline Florian WartenbergFriend
Messages: 25
Registered: July 2012
Junior Member
"Integer" does not change anything still no Type Sad
Re: PrimitiveType [message #908625 is a reply to message #908621] Wed, 05 September 2012 17:07 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I cannot help you if you do not provide a problem that is reproducible
or comments that are meaningful.

Regards

Ed Willink

On 05/09/2012 18:03, Florian Wartenberg wrote:
> "Integer" does not change anything still no Type :(
Re: PrimitiveType [message #908642 is a reply to message #908625] Wed, 05 September 2012 18:05 Go to previous messageGo to next message
Florian Wartenberg is currently offline Florian WartenbergFriend
Messages: 25
Registered: July 2012
Junior Member
Ok I have a .uml file which I load then I do some transformations on the model. At some point I have to create a new property inside my main class. Therefore I use the line written above. My property is created but has no type. I want to have a property which has the type "<PrimitveType> Integer" which several other properties of the model already have. The second argument of the method is "Type" I do not know what Java or EMF is expecting me to resolve it to so I get the Integer type. If I for example resolve the second argument to my class ("modelClass") then the property is created whith a type and the type is <Class> ECU which is the name of my class inside the model.

regards Florian
Re: PrimitiveType [message #908697 is a reply to message #908642] Wed, 05 September 2012 20:42 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Precisely. You have a UML file. I have nothing I can reproduce. I wish
you luck with your problem.

Regards

Ed Willink


On 05/09/2012 19:05, Florian Wartenberg wrote:
> Ok I have a .uml file which I load then I do some transformations on
> the model. At some point I have to create a new property inside my
> main class. Therefore I use the line written above. My property is
> created but has no type. I want to have a property which has the type
> "<PrimitveType> Integer" which several other properties of the model
> already have. The second argument of the method is "Type" I do not
> know what Java or EMF is expecting me to resolve it to so I get the
> Integer type. If I for example resolve the second argument to my class
> ("modelClass") then the property is created whith a type and the type
> is <Class> ECU which is the name of my class inside the model.
>
> regards Florian
Re: PrimitiveType [message #908767 is a reply to message #908642] Thu, 06 September 2012 01:01 Go to previous message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Florian,

If you have other classes in your model that have properties that
reference Integer as their type, then where did they get it from?
Probably it is the Integer in the UML Primitive Types library. The URI
for the library resource is

pathmap://UML_LIBRARIES/UMLPrimitiveTypes.profile.uml

You would see it already loaded in the editor if you open your model in
the UML Editor.

Anyways, given that you already have properties of Integer type, you
should be able to find the library resource (URI as above) loaded in
your resource set. The first element in the resource is a package on
which you can use the getOwnedType(…) method that you mentioned
earlier, to get the Integer type.

HTH,

Christian


On 2012-09-05 18:05:40 +0000, Florian Wartenberg said:

> Ok I have a .uml file which I load then I do some transformations on
> the model. At some point I have to create a new property inside my main
> class. Therefore I use the line written above. My property is created
> but has no type. I want to have a property which has the type
> "<PrimitveType> Integer" which several other properties of the model
> already have. The second argument of the method is "Type" I do not know
> what Java or EMF is expecting me to resolve it to so I get the Integer
> type. If I for example resolve the second argument to my class
> ("modelClass") then the property is created whith a type and the type
> is <Class> ECU which is the name of my class inside the model.
>
> regards Florian
Previous Topic:TimeObservation for transitions
Next Topic:ApplyStereotypes takes seconds at first time
Goto Forum:
  


Current Time: Thu Apr 18 13:02:25 GMT 2024

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

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

Back to the top