Modeling Java "final" and exceptions

"Tom Morris" <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.user
Message-ID <[email protected]>
Someone with the screename of "javacikiz" asked the following question
on the bulletin board.  I'm copying my answer here so it'll get
preserved in the archives and everyone can benefit:

> i am trying to make diagrams of an java program in argouml.but i cant find some features.
> for example, i couldnt make any final classes. amd i dont know how can i make to implement
> a class.i am not sure if "frozen" means "final" or not.  also how can i handle with exceptions.
> how can i make a method like this:
> public static TicketContextMessage send( String xml) throws IOException

First of all, if your only goal is to create a Java program, it should
be obvious that it's a lot less work to just type it into a text
editor and if you've got a Java program the easiest way to create the
corresponding model is to reverse engineer it using the "Import
Sources" facility, but I'll presume you've got some other good reason
for wanting to do this by hand (class assignment?).

The Java keyword means at least two different things that I can think
of off the top of my head, depending on its context.  A final class is
one which can't be subclassed.  This maps to the UML notion of "leaf"
which is the element in an inheritance "tree."  A final field in a
Java class would map to "addOnly" or "frozen" for a UML Attribute.

UML Exceptions are a subclass of Signal, so they get added to the
"Raised Signals" pane on the property panel for an Operation.

Tom

p.s.  I forgot to add that this is all conceptual information.  It
doesn't necessarily map to what the Java code generator actually
generates for code.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.