Book a Demo

Author Topic: How can an activity invoke a behavior defined in a subclass of its own class?  (Read 19265 times)

ea1122

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Class A contains activity A() and a subclass B containing activity B().
But when A() calls B() a code error is generated:
   public void A(a, b) {
      // behavior is a Activity
      /*Warning: B - Invoking behaviors from other classes - Not Supported!!*/
   }
So how does an activity invoke a behavior defined in a subclass of its own class?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13506
  • Karma: +572/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Class A contains activity A() and a subclass B containing activity B().
But when A() calls B() a code error is generated:
   public void A(a, b) {
      // behavior is a Activity
      /*Warning: B - Invoking behaviors from other classes - Not Supported!!*/
   }
So how does an activity invoke a behavior defined in a subclass of its own class?
Don't you think it's a bit weird that a class knows about it's subclasses? I think that violates the Open/Closed principle

But regardless of that, apparently, as indicated by the warning messages, invoking behaviors defined in other classes (whether they are subclases or not) is not supported.

Geert


ea1122

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Thank you for your reply!
If all activities must be defined in the same class as any invoking activity, should all activities be in the same class to permit them to invoke each other?
Separating classes permits grouping of related components, the main value of classes.
I much appreciate your help!

ea1122

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
OK, I see my error.