Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » how can i customize primitive types to contain a few more attributes?
how can i customize primitive types to contain a few more attributes? [message #793547] Wed, 08 February 2012 09:23 Go to next message
B Simpson is currently offline B SimpsonFriend
Messages: 25
Registered: January 2012
Junior Member
hi,
i'd like to specify additional properties to my data types.
the idea is that i would import XMLprimitivetypes and somehow customized them/extended them.

i can imagine i would use stereotypes for that. i would have class 'User' with attribute 'login' which would have 'max_length' set to 255.
perhaps i could have 'login' field set to 'String' and then apply 'String' stereotype to it (having 'max_length' 255) if that is still clear.
could i possibly do it by 'extending' primitive types? or is it a no-no alternative?
Re: how can i customize primitive types to contain a few more attributes? [message #793982 is a reply to message #793547] Wed, 08 February 2012 19:56 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Primitive Types are absolutekly not extensible; they are primitive.

If for instance you want a length with units then use a class with value
and units properties.

Regards

Ed Willink

On 08/02/2012 09:24, B Simpson wrote:
> hi,
> i'd like to specify additional properties to my data types.
> the idea is that i would import XMLprimitivetypes and somehow
> customized them/extended them.
>
> i can imagine i would use stereotypes for that. i would have class
> 'User' with attribute 'login' which would have 'max_length' set to 255.
> perhaps i could have 'login' field set to 'String' and then apply
> 'String' stereotype to it (having 'max_length' 255) if that is still
> clear.
> could i possibly do it by 'extending' primitive types? or is it a
> no-no alternative?
Re: how can i customize primitive types to contain a few more attributes? [message #797207 is a reply to message #793982] Mon, 13 February 2012 07:08 Go to previous messageGo to next message
Eclipse UserFriend
Hi all,

@Ed: Sorry, but this is not true for UML. Technically, you can actually put
as many attributes into a PrimitiveType as you would like to. PrimitiveType
is a subclass of DataType, so it inherits the capabilities of owning
attributes and operations. At least the MARTE profile makes use of this
capability, when defining the allowed operations on a primitive type. You
could even specialize PrimitiveTypes.

Semantically, primitive type are kind of abstract data types, i.e. a data
structure that is hidden behind a scalara knowledge attribute, thus, the
details of the data implementation's are not relevant at this level of
abstraction. I would go for DataType rather, if I want to model attributes
and constraints on that attributes.

Marc-Florian

"Ed Willink" schrieb im Newsbeitrag news:jguk0s$9j9$1@news.eclipse.org...

Hi

Primitive Types are absolutekly not extensible; they are primitive.

If for instance you want a length with units then use a class with value
and units properties.

Regards

Ed Willink

On 08/02/2012 09:24, B Simpson wrote:
> hi,
> i'd like to specify additional properties to my data types.
> the idea is that i would import XMLprimitivetypes and somehow customized
> them/extended them.
>
> i can imagine i would use stereotypes for that. i would have class 'User'
> with attribute 'login' which would have 'max_length' set to 255.
> perhaps i could have 'login' field set to 'String' and then apply 'String'
> stereotype to it (having 'max_length' 255) if that is still clear.
> could i possibly do it by 'extending' primitive types? or is it a no-no
> alternative?
Re: how can i customize primitive types to contain a few more attributes? [message #797287 is a reply to message #797207] Mon, 13 February 2012 09:25 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Florian

Certainly PrimitiveType is extensible to allow all its instances to have
for instance an asciiRepresentation. But the Primitive Types (String
etc) do not define a mechanism whereby just String has a toUpperCase()
operation. The UML Primitive Types are magic; they have values without
any associated attributes, operations or supertypes. This vagueness is
good. It requires and allows practical usages to define them. So OCL has
a StringValue to realize the StringType with corresponding operations.

Regards

Ed Willink

On 13/02/2012 07:08, Florian Wendland wrote:
> Hi all,
>
> @Ed: Sorry, but this is not true for UML. Technically, you can
> actually put as many attributes into a PrimitiveType as you would like
> to. PrimitiveType is a subclass of DataType, so it inherits the
> capabilities of owning attributes and operations. At least the MARTE
> profile makes use of this capability, when defining the allowed
> operations on a primitive type. You could even specialize PrimitiveTypes.
>
> Semantically, primitive type are kind of abstract data types, i.e. a
> data structure that is hidden behind a scalara knowledge attribute,
> thus, the details of the data implementation's are not relevant at
> this level of abstraction. I would go for DataType rather, if I want
> to model attributes and constraints on that attributes.
>
> Marc-Florian
>
> "Ed Willink" schrieb im Newsbeitrag
> news:jguk0s$9j9$1@news.eclipse.org...
>
> Hi
>
> Primitive Types are absolutekly not extensible; they are primitive.
>
> If for instance you want a length with units then use a class with value
> and units properties.
>
> Regards
>
> Ed Willink
>
> On 08/02/2012 09:24, B Simpson wrote:
>> hi,
>> i'd like to specify additional properties to my data types.
>> the idea is that i would import XMLprimitivetypes and somehow
>> customized them/extended them.
>>
>> i can imagine i would use stereotypes for that. i would have class
>> 'User' with attribute 'login' which would have 'max_length' set to 255.
>> perhaps i could have 'login' field set to 'String' and then apply
>> 'String' stereotype to it (having 'max_length' 255) if that is still
>> clear.
>> could i possibly do it by 'extending' primitive types? or is it a
>> no-no alternative?
>
Previous Topic:3rd Biannual Eclipse/OMG Workshop on March 25
Next Topic:model.di is empty
Goto Forum:
  


Current Time: Fri Apr 19 20:22:56 GMT 2024

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

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

Back to the top