Book a Demo

Author Topic: abstract property for interface  (Read 5138 times)

blackpuppy

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
abstract property for interface
« 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
« Last Edit: March 28, 2005, 01:12:55 am by blackpuppy »
Best regards!
Zhu Ming

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: abstract property for interface
« Reply #1 on: March 28, 2005, 03:41:50 pm »
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

blackpuppy

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: abstract property for interface
« Reply #2 on: March 28, 2005, 06:51:12 pm »
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
Best regards!
Zhu Ming

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: abstract property for interface
« Reply #3 on: March 28, 2005, 09:15:05 pm »
I think what you're after is creating a tagged value "readonly" = "true" or "writeonly" = "true".

Simon

blackpuppy

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: abstract property for interface
« Reply #4 on: March 28, 2005, 10:50:45 pm »
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!
« Last Edit: March 29, 2005, 12:32:20 am by blackpuppy »
Best regards!
Zhu Ming

thomaskilian

  • Guest
Re: abstract property for interface
« Reply #5 on: March 29, 2005, 01:54:07 am »
You can create any tag on the fly (sometimes you will not like that, sometimes you will).

2nd question - pass  :-/

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: abstract property for interface
« Reply #6 on: March 29, 2005, 03:37:22 pm »
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
« Last Edit: March 29, 2005, 03:39:21 pm by sargasso »
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.