Book a Demo

Author Topic: Code template : show namespace on inherited class  (Read 7825 times)

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Code template : show namespace on inherited class
« on: April 24, 2013, 05:30:06 am »
Hi,

I need to update a custom code template so when I have Class1 that inherits from Class2 from a different package, I need to display the name of the owning package of the super class before the class name.

e.g. I currently get
class Class2 : Class1
{
///
};

I need to get
class Class2 : Pck1::Class1
{
///
};

I seem to have to modify Class Inherit Template to add a NameSpace to the ClassBase.
I tried a couple of options but it doesn't work, any idea?

thanks
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Code template : show namespace on inherited cl
« Reply #1 on: April 24, 2013, 08:35:35 am »
I think you want either

%RESOLVE_QUALIFIED_TYPE("::")%

or


%linkParentQualName%

The first tries to do it intelligently. (ie. not including the namespace if it's the same as the current class)

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Code template : show namespace on inherited cl
« Reply #2 on: April 24, 2013, 03:47:42 pm »
Hi Simon,

Thanks for your answer. I'm trying to resolve the Interface inheritance in the MDG Corba when an interface inherits from an interface located in a different package, but I cannot find where to add what you suggested in the following.

Any idea?

Thanks
Guillaume

%if classStereotype=="CORBATypedef" or classStereotype=="CORBAArray" or classStereotype=="CORBASequence"%
%PI=""%
$inherits = %list="ClassBase" @separator=", "%
%if $inherits == ""%
any
%else%
$inherits
%endIf%
%endTemplate%

%list="ClassBase" @separator=",\n\t"%
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Code template : show namespace on inherited cl
« Reply #3 on: April 24, 2013, 04:31:35 pm »
The list on "ClassBase" calls either the Class Base template or Linked Class Base template.

You need to modify Linked Class Base.