Book a Demo

Author Topic: Access to Java data type and classes  (Read 4717 times)

rarrigo

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Access to Java data type and classes
« on: October 30, 2003, 12:46:40 pm »
Hi, I'm new to using Enterprise Architect.

I'm trying to model some Java classes. When I add an attribute and assign a datatype, I would like to have access to many of the standard Java classes such as Collections, Iterators, etc. I have not found a way, other than importing the java source files into the model to get access to these.  

I know that I can use the "Language Datatypes" to manually add them in. But I'm thinking there should be an easier way to do this.

Can anyone help?

Thanks, Ron

funkiwan

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Access to Java data type and classes
« Reply #1 on: November 01, 2003, 01:43:28 pm »
I'd love to know how to do this as well!

dlramsey

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Access to Java data type and classes
« Reply #2 on: February 02, 2004, 02:05:29 pm »
Facing this same problem, I installed the java sources with the SDK and then selectively imported subsets. For starters I imported the entire java. namespace and then the entire javax. namespace that comes with the SDK. (Note that this is not the entire javax namespace, just that subset in the SDK.)

At this point the project file was approximately 38 MB in size. I then created a master, for master/replica creation, and that expanded the baseline project file to about 51 MB before we began bringing in any of our own code.

The advantage to this approach is that everything is available to me as a designer from Swing to java.sql to java.util.regex. The disadvantage is the overall size of the master project file. If someone would like a copy, I can see about some way to make it available. The java/javax baseline, without conversion to a "master" is 38MB and compresses to 11MB.

I do not have the ability to email 11MB images nor do I have a place to host such an image for FTP access but I am more than willing to make it available to someone if they are interested. Or, if Sparx would like to host it, perhaps some solution could be worked out there.


Note that I had to resolve about 2-3 dozen ambiguities during reverse engineering and in many of these cases I guessed rather than opening yet another source file and trying to figure out what the tool was concerned about. I have not yet found that any of these guesses are "wrong" nor have they impacted my own design efforts yet and if they do, I will simply amend my project as needed.

The entire importation process took me the better part of an afternoon but I was also doing other activities during this time frame.

I give high marks to EA and its reverse engineering tools for scaling to such a huge base and still maintaining a small memory footprint, fast speed, and so far, great stability even still.

yyz

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Access to Java data type and classes
« Reply #3 on: August 04, 2004, 02:28:27 pm »
If you're not happy with the "package::Class" notation used in Class Diagrams, for example, you can add aliases to each of the Java classes you import and tell EA to use those aliases in the diagram.

For example, you can change the alias (select class in Project View, right-click and choose Properties) for the String class to be "java.lang.String".

Then, in the diagram, change it's properties to use the alias (right-click on diagram -> Diagram Properties...  -> Use Alias If Available).

You classes will then be labeled:

java.lang.String

rather than:

lang::String

If you're a UML purist and demand the latter form, it's easy enough to turn off.

Fair amount of scut work to alias all of the classes but it can be automated.