Generate Java from UML: Default values are missing

This topic contains 6 replies, has 2 voices, and was last updated by Profile photo of support-swapna support-swapna 3 years, 10 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #321402

    When generating Java from a UML class diagram by following these steps:

    Select abc.uml, right click, MyEclipse, Generate Java …

    Default values of class attributes are missing from generated Java class.


    STUBTYPE : String = EJBStub

    – Generated:
    private static String STUBTYPE;

    – Expected:
    private static String STUBTYPE = “EJBStub”;

    *** Date:
    Friday, November 25, 2011 3:17:05 PM EST

    ** System properties:
    OS version=5.1.0
    Java version=1.6.0_21

    Installation Summary:

    *** MyEclipse details:
    MyEclipse Enterprise Workbench
    Version: 9.1
    Build id: 9.1-20110701

    *** Eclipse details:
    Eclipse Java EE IDE for Web Developers.

    Version: Helios Service Release 2
    Build id: 20110218-0911

    Eclipse Platform

    Version: 3.6.2.r362_v20110210-9gF78Gs1FrIGnHDHWkEcopoN8AmxeZflGDGKQi
    Build id: M20110210-1200

    Eclipse Java Development Tools

    Version: 3.6.2.r362_v20101117-0800-7z8XFW6FLFlmjJcvz03jyeFBLS_F
    Build id: M20110210-1200

    Eclipse Graphical Editing Framework GEF

    Version: 3.6.1.v20100908-1100-777B181A3Bz-6B663E7974242
    Build id: 201009132020

    Eclipse RCP

    Version: 3.6.2.r362_v20101104-9SAxFMKFkSAqi8axkv1ZjegmiBLY
    Build id: M20110210-1200

    Eclipse Plug-in Development Environment

    Version: 3.6.2.r362_v20110203-7b7mFL2FET3dhHalh1iNZtL
    Build id: M20110210-1200

    Eclipse startup command=-os

    Profile photo of support-swapna

    myeclipse_user_1 ,

    Sorry that you are seeing this issue with MyEclipse.

    Can you answer some more questions for us ?

    1) How did you install MyEclipse ? Is it through All-In-One Installer/Pulse/ Archived Update Site ?

    2) Also share your Operating System and version details.

    3) Can you give us detail steps on how you are creating the uml class diagram and adding the Stubtype to it for us to be able to replicate it at our end ?


    I installed eclipse JEE helios SR2 first:
    File Name:

    Then installed myeclipse (Help -> Install New Software). Installed everything except for “MyEclipse Spring Optional Modules”.
    File Name:

    Also, I was able to recreate this in MyEclipse 10:
    File Name: myeclipse-10.0-offline-installer-windows.exe

    Operating System:
    Windows XP – Service Pack 3

    – Create test.uml (New -> MyEclipse -> UML -> UML2 Model -> test.uml)
    – Create TestClass in test.umldi
    – Select TestClass -> right click -> Add Property -> add new property called STUBTYPE
    – Goto Outline -> Select <Model> test -> Rigth Click -> Generate Primitive Types -> UML
    – Select STUBTYPE -> right click -> Show Properties -> Model -> Type -> String
    – Select STUBTYPE -> right click -> Show Properties -> Advanced -> Default -> enter EJBStub (I tried “EJBStub” as well)
    – Save all changes
    – Goto Package Explorer -> Select test.uml -> Right Click -> MyEclipse -> Generate Java -> select /src of an existing Java Project -> Finish
    – Open in that /src folder
    – Default value we entered (EJBStub) is missing

    Profile photo of support-swapna


    Thank you for the detailed steps. I could replicate the issue at my end.
    I have filed a PR for the dev team to work on it.
    Sorry for any inconvenience caused.

    Profile photo of support-swapna

    myeclipse_user_1 ,

    I could get the default value in the generated class by selecting the isReadOnly option.
    Select STUBTYPE -> right click -> Show Properties -> Model > Check the isReadOnly

    Attached is the screenshot for your reference.

    Let us know how it works for you.

    You must be logged in to view attached files.

    Thanks for your reply.

    I tried the steps you mentioned and it works fine. But it generated “final” attribute which is correct since we wanted it to be read only.

    In our case, we do not want the attribute to be “final”.

    Profile photo of support-swapna

    myeclipse_user_1 ,

    Our dev team is working on this issue. You can see it fixed in the next release.
    Sorry for any inconvenience caused.

Viewing 7 posts - 1 through 7 (of 7 total)

The forum ‘UML Development’ is closed to new topics and replies.