[Uml-devel] JavaCodeGenerator

Brian Thomas thomas at mail630.gsfc.nasa.gov
Fri Feb 28 11:18:26 UTC 2003


	Hi all,

	I suppose that I could iterate on this forever, but its pretty much done for now.
	Since this is a massive re-write of the original files, Im just going to append them
	to this email rather than make a diff, which winds up being about the same size.

	Here are some features of the new code generator:

	- Proper conversion of UML typeNames to Java standard (e.g. "string" -> "String" and "bool" -> "boolean")
	- Proper consideration of roles in generation of fields
	- Generates methods with Java name syntax (e.g. "getName" instead of "getname" or "getNAME").
	- Accessor methods both for association roles and class attributes generated
	as appropriate.
	- Multiplicity, Scope and Changeablity considered properly for generation of methods
	- Self-association (e.g. at_Associations) will be used properly to generate methods.
	- Commenting much more extensive. Carries documentation on attributes, associations, 
	classes into the generated code document. Lots of auto-generated commenting.
	- better organization (IMO) of output methods (tries to group methods by type, although
	there are cases where it doesnt group as well as I would like).

	Whew. What does this NOT do? Well, plenty.. but here are some top priorities (again, IMO):

	- multiplicity should be limited to a carrier class, not transported about as a String that has to
	be interpreted. IF someone uses older standards to specify multiplicity, the code generator could
	fail.

	- No means to have a template that directs how code generation for that class (or indeed the whole
	package) is available. You cant have utillity methods that specify things like class->getName() is 
	equivalent to class->getNameObject()->toString(). You cant have any other kind of constructor
	for the class other than the void constructor (e.g. new Class()). How do you get a method/field to
	specitfy an enumerated list (e.g. only a selected number of choices available) And so on.. there are 
	many things that a template for the generation could fix (either because UML wont allow you to specify
	something or its a language specific construction that UML _isnt_ supposed to specify) in order to make 
	code generation (not just for Java) truely usefull (and I will follow up this thought in a separate email 
	with what to do about this in the umbrello project).

	- No class associations available. This means you cant specify that a given association obeys an
	interface or class. This is in part because umbrello wont let you diagram these type of associations.

	- description (comments) on association roles not carried through. This is in part a failing of the association
	model in umbrello. 

	Thats all for now. COmments and suggestions on how to improve this code generator are welcome!!

							-b.t.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: javawriter.h
Type: text/x-chdr
Size: 4394 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/umbrello-devel/attachments/20030228/45c46045/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: javawriter.cpp
Type: text/x-c++src
Size: 23542 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/umbrello-devel/attachments/20030228/45c46045/attachment.cpp>


More information about the umbrello-devel mailing list