Book a Demo

Author Topic: Excluding static fields from class diagrams  (Read 4204 times)

Byron Hawkins

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Excluding static fields from class diagrams
« on: August 26, 2010, 06:01:52 am »
Hi all,

I'm trying to create a class diagram that never shows any static fields. These fields always have a utility purpose, such as database queries, and are not part of the logical class model. Is there a way to automatically restrict static fields from being displayed? Thanks for your help.


Byron

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Excluding static fields from class diagrams
« Reply #1 on: August 26, 2010, 08:47:23 am »
There isn't an option for static fields.

The best suggestion would be to stereotype them and then filter out that stereotype.

Byron Hawkins

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Excluding static fields from class diagrams
« Reply #2 on: August 26, 2010, 11:00:49 am »
Thanks, that does work. But is there any way to:

1. automatically stereotype all static fields and methods with the "static" stereotype? It seems like the source code importer should do this by default. Are plugins or customizations possible for source code import?

2. apply hiding of the "static" stereotype to the entire diagram, instead of applying it tediously to one class at a time?

Thanks for your help.

Byron Hawkins

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Excluding static fields from class diagrams
« Reply #3 on: August 26, 2010, 11:12:21 am »
ok, I figured out how to hide statics for the whole diagram. Now I just need a way for either the importer or the diagram to figure out that Java static fields and methods are inherently belonging to the static stereotype. Any suggestions?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Excluding static fields from class diagrams
« Reply #4 on: August 26, 2010, 03:11:05 pm »
Byron,

First of all, the importer should NOT apply "static" stereotype to each attribute, as that would be redundant information (it already has the standard static flag).

To avoid all this tedious work, you could write a little script to hide the static attributes on your diagram.
You could either automatically add the static stereotype to static attributes, or even better, forget about the stereotype and just hide the static attributes directly.

Geert

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Excluding static fields from class diagrams
« Reply #5 on: August 26, 2010, 05:06:20 pm »
Geert said exactly what I would have replied.  (Just so you have an official response.)

Byron Hawkins

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Excluding static fields from class diagrams
« Reply #6 on: August 26, 2010, 06:12:38 pm »
Wow, I had no idea there was script support here. I'm new to the tool, as you can probably tell  :) Thanks for your help!