Book a Demo

Author Topic: Cannot add "sealed" attribute to a class  (Read 6036 times)

Emilio

  • EA User
  • **
  • Posts: 78
  • Karma: +0/-0
    • View Profile
Cannot add "sealed" attribute to a class
« on: July 31, 2008, 09:36:45 pm »
Something very weird. I selected the Properties of a class in my class model and there is no way you can specify attributes such as "static" or "sealed" for the class, you can only say it is "abstract". In C# these are valid attributes for a class.

However, if I select a METHOD in this class to edit it, then I can specify "sealed" and other attributes for the METHOD.

I am using EA 7.1 Professional Edition.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Cannot add "sealed" attribute to a class
« Reply #1 on: July 31, 2008, 09:54:38 pm »
There's a rather obscure note in the EA help file that says: "The Is Leaf property of a Class corresponds to the sealed keyword."

You'll find this under Other Conventions at the bottom of the C# Conventions page. That page appears in the Index under C# | Modeling Conventions.

HTH, David
No, you can't have it!

Emilio

  • EA User
  • **
  • Posts: 78
  • Karma: +0/-0
    • View Profile
Re: Cannot add "sealed" attribute to a class
« Reply #2 on: July 31, 2008, 11:11:00 pm »
Thanks for the info. However, I think it would be more user friendly if based on the current setting of the classes "Implementation Language" (a drop down list in the properties) the names on the "Advanced" popup are changed (at runtime) to something that corresponds to the chosen language.

That means that if one were to pop up a C# class property and clicked on the "Advanced" button, the "Is Leaf" checkbox would show "sealed" rather than the obscure "is leaf".

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Cannot add "sealed" attribute to a class
« Reply #3 on: August 01, 2008, 12:21:07 am »
Perhaps, but that's a decision Sparx will need to make. I suspect without proof that this got shoehorned in some time ago, when EA was less feature-rich. IsLeaf is not an unreasonable place for this attribute, given the UML sense of the property.

But as I said, this is somewhat cryptic. Whether you want to consider that as purely a documentation issue or a quirk in the EA product structure is up to you.

Why not make a feature request that this be clarified in some manner? The points you make in your post should be included. You'll find the appropriate form by clicking the Feature Request link under the Support link near the bottom of any forum page. After all, Sparx can't change it for us if we don't tell them what we want...

David
No, you can't have it!

ThomasO

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Cannot add "sealed" attribute to a class
« Reply #4 on: August 01, 2008, 12:45:54 am »
Hello,
do you also can tell me, how I can create a static class with EA. The genereated C# code should have the static keyword in the class declaration and no constructor ect.

Thanks
Thomas

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Cannot add "sealed" attribute to a class
« Reply #5 on: August 01, 2008, 08:49:12 am »
As I understand the EA help passage I cited above, the solution would be...

Open the class properties dialog. Click the Advanced button to bring up the Advanced Options dialog. The check Is Leaf and accept both dialogs.

You could verify this in of two ways. Either try the above and generate the code, or reverse engineer a static class into EA and check the advanced properties. I suggest the second - reverse engineering - since you might observe other things that EA does.

Reverse engineering example software is a useful trick for learning how EA handles various software constructs.

David
No, you can't have it!