MyEclipse: Generate Java from UML: Default values are missing myeclipse_user_1 - Nov 25, 2011 - 08:30 PM Post subject: Generate Java from UML: Default values are missing
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.
Eclipse startup command=-os
win32
-ws
win32
-arch
x86
-showsplash
-launcher
C:\Chordiant_6_6\eclipse\eclipse.exe
-name
Eclipse
--launcher.library
C:\Chordiant_6_6\eclipse\plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.2.R36x_v20101222\eclipse_1312.dll
-startup
C:\Chordiant_6_6\eclipse\plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
-exitdata
aa4_40
-product
org.eclipse.epp.package.jee.product
-showlocation
-data
C:\POC_Project_9_0
-vm
C:/Chordiant_6_6/Oracle/Middleware/jdk160_21/bin/javaw.exesupport-swapna - Nov 28, 2011 - 10:47 AM Post subject:
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 ?myeclipse_user_1 - Nov 28, 2011 - 02:25 PM Post subject:
1)
I installed eclipse JEE helios SR2 first:
File Name: eclipse-jee-helios-SR2-win32.zip
Then installed myeclipse (Help -> Install New Software). Installed everything except for "MyEclipse Spring Optional Modules".
File Name: myeclipse-9.1-archived-update-site.zip
Also, I was able to recreate this in MyEclipse 10:
File Name: myeclipse-10.0-offline-installer-windows.exe
2)
Operating System:
Windows XP - Service Pack 3
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 TestClass.java in that /src folder
- Default value we entered (EJBStub) is missingsupport-swapna - Nov 29, 2011 - 05:45 AM Post subject:
myeclipse_user_1,
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.support-swapna - Dec 09, 2011 - 09:07 AM Post subject:
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.myeclipse_user_1 - Dec 12, 2011 - 01:42 PM Post subject:
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".support-swapna - Dec 13, 2011 - 06:18 AM Post subject:
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.