Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: blackpuppy on March 28, 2005, 01:11:08 am
-
How to define a property in an inteface?
I want to add some classes and interfaces of .NET Framework in my model. My own classes will inherit these classes and implement these interfaces. Since it is an interface, the property is abstract. In EA, when I define a property, it asks me to select an attribute. It seems that I must define an attribute first. But for interface, I should be able to define the property without defining an attribute. Maybe I'm doing it in the wrong way. I'll be appreciated if anyone can tell me how to do it.
BTW, is there an existing package for .NET Base Class Library that I could import into my own EA model? It will be greate if it does exist.
Thanks!
Zhu Ming
-
You should be able to just create a method and set the stereotype to property.
It's also been brought to my attention that you probably don't want to select these in the Override Operations/Interfaces dialog. When creating an property for the realising class it will create a new property method even if there already is one in the model.
Simon
-
Thanks, Simon!
My colleague noticed this later on too. We are still new to EA. It would be better if the help is more task-oriented.
When I generate the property from an existing private int attribute, I set the property to read/write. So it has both get and set method. I can change this by going to the attribute and clicking the property option and then a "Modify Property Implementation" window will pops up for me to change the property to readonly/writeonly/readwrite.
If defining an operation of property sereotype without a linked attribute, how could I change the property implementation to have just get or set, or both get/set later? How could I load that "Modify Property Implementation" window?
Thanks!
Zhu Ming
-
I think what you're after is creating a tagged value "readonly" = "true" or "writeonly" = "true".
Simon
-
I found I can add the tagged value for readonly and writeonly without adding tagged value type readonly and writeonly first. Are they built in? Or no type is needed at all. I see these two tagged values are checked in the class operation template for property. I see EA is great in its extensibility, just it's so intuitive.
I have another question about property. Since get and set operations of a property are represented as one operation in EA model, how could I differentiate the set and get in the communication/sequence diagram? I found that it is always get operation such as "2.1: string:= Code()" where "Code" is the name of the property. How to specify a set operation of the property?
Thanks!
-
You can create any tag on the fly (sometimes you will not like that, sometimes you will).
2nd question - pass :-/
-
2nd question...
You have to manually type in the exact message in the message field, e.g. Code()=string and set the return to void or blank it.
Painful huh!
bruce