Book a Demo

Author Topic: Determination "is type of"  (Read 5307 times)

xhanness

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
    • View Profile
Determination "is type of"
« on: March 17, 2009, 10:05:22 pm »
Hi,

I am writing a MDA trasnformation and I wonder, if there is possibility to find out, if a class is a subtype of a superclass.
I have a quite large hierarchy of classes so I can not simply test, if a current class has connector of Genereliazation type to any its connected  classes.

thanks for any hints
« Last Edit: March 17, 2009, 10:05:51 pm by xhanness »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Determination "is type of"
« Reply #1 on: March 17, 2009, 10:53:48 pm »
Element.BaseClasses should give you a list of all the superclasses.
So if the superclass is in the list, the element is a subclass.

xhanness

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
    • View Profile
Re: Determination "is type of"
« Reply #2 on: March 17, 2009, 11:32:00 pm »
thanks for the answer. But can I also make the test when I use the macro - language? It is easy to test in Java or C#, but is it possible to do it with macros? If u can provide me some example, I would be really glad. thanks

xhanness

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
    • View Profile
Re: Determination "is type of"
« Reply #3 on: April 19, 2009, 04:23:15 am »
well, I will answer my question. There exists a way, how to use all API functions from macro language. For this reason there is a macro EXEC_ADD_IN. It can execute a public method from your plugin.

Code: [Select]
$a="a"
  $b="b"
  $result = %EXEC_ADD_IN("XGuiLayoutPlg","xxxY",$a, $b)%

and corresponding c# code goes here
Code: [Select]
public object xxxY(EA.Repository aRepository, object aParameters)
{
  string[] parameters = (string[]) aParameters;
  return parameters[0] + "_" + parameters[1];
}

xhannes
« Last Edit: April 19, 2009, 04:24:00 am by xhanness »