Generate Java import statements from UML class diagrams

Hello All,
I am using VP SDE-EC Standard Edition V5.0. I’d like to generate Java code out of class diagrams that use utility classes like java.util.GregorianCalendar. So the container class contains statements like

private GregorianCalendar _lastEdited;

This code is generated by the Java code generator. What I don’t know is how to make the generator create the corresponding import statement, like in this case

import java.util.GregorianCalendar;

Any hints?
Thanks in advance,
Andy

Hi Andy,

Thanks for your post. We already support generate import fully-qualified statement in Instant Generator for Java in SDE-EC (please refer to the attached image). Could you please tell me which build you are using (can get from About dialog of SDE-EC), and send me a sample project to repeat your problem? Thanks in advance!

Best regards,
Lilian Wong
import_statement.png

Hello Lilian,

I was pretty sure that this is supported, I just didn’t know how to do it. Meanwhile I know that I have to enter the full qualified name of the class in the attribute definition, like in this case ‘java.util.GregorianCalendar’. That is all. I let myself mislead by the fact that in some cases (like for class relationships via lists) VP does generate the necessary import statements automatically (like ‘import java.util.Vector;’).

Thanks for your reply anyway,
and sorry for the silly question.
Andy

Hi Andy,

Thanks for replying. I believe you did not have “java.util.GregorianCalendar” in your class repository so that it does not generate the import statement in code. Please refer to the following flash movie of how to get the Java library class in your class repository and generate the fully-qualified import statement:

http://files4.visual-paradigm.com/200909/reverse_Java_library_for_generate_import_statement.htm

Hope this solves your problem.

Best regards,
Lilian Wong

Hello Lilian,

Yes it does. Thanks a lot.

Kind regards,
Andy

Hi Andy,

It’s my pleasure. :smiley:

Best regards,
Lilian Wong