Book a Demo

Author Topic: Mark attributes/methods as deprecated  (Read 5977 times)

shock

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Mark attributes/methods as deprecated
« on: March 01, 2014, 11:59:29 pm »
Hi there,

I'm using EA to generate Java code from class models. Now I'd like to mark some methods as deprecated to show, they will be removed in one of the upcoming library versions. How would I do that?

TIA
shock

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Mark attributes/methods as deprecated
« Reply #1 on: March 02, 2014, 12:51:17 am »
Hi,

some ways to do it:
  • Stereotype <<depreciated>> or so
  • Tagged value isDepreciated of type boolean
  • Use the note to express: It is depreciated

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

shock

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Mark attributes/methods as deprecated
« Reply #2 on: March 02, 2014, 02:50:31 am »
Thank you Helmut. These ways would transport the information to the developers. I already wrote things into the comments.

To state my question more precisely: I'm looking for a way that renders the annotation @Deprecated into the generated classes automatically.

TIA
shock

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Mark attributes/methods as deprecated
« Reply #3 on: March 02, 2014, 09:18:51 am »
Create a little MDG that will color <<deprecated>> elements with red color. I did that in the past.

q.

Nizam Mohamed

  • EA User
  • **
  • Posts: 193
  • Karma: +1/-0
    • View Profile
Re: Mark attributes/methods as deprecated
« Reply #4 on: March 02, 2014, 12:00:57 pm »
If you want @Deprecated in generated source code.. further to what Helmut has said, you can modify the code generation templates to check for the tag and add the required comment.
Something like
Code: [Select]
%opTag:"Depreciated" == "@Depreceated" ? ""%
If you want to leverage the comments that you've already added into the methods,
  • use either a script to auto create tagged values for you and check for the tag in code gen templates

or
  • Use string find to check for existence of deprecated related comments.