How to manipulate java models once parsed JavaDiscoverer [message #670986] |
Mon, 16 May 2011 13:02 |
|
Hi to all,
I want to implement a converter from junit 3 to junit 4.
So I have discoverd a model and can step through ist.
Now I want to to some modifications with my model.
For example, I want to add some annotations, but don't know how to add this programmatically, because not knowing how I get the type itself from a FQN, to add thisone to the EList afterwards.
Can you please help me?
Thanks in advance
Markus
[Updated on: Mon, 16 May 2011 17:16] Report message to a moderator
|
|
|
|
Re: How to manipulate java models once parsed JavaDiscoverer [message #671153 is a reply to message #671075] |
Mon, 16 May 2011 22:23 |
|
Hi Fabien,
thank you for your quick answer.
This junit3->junit4 is only the first usecase we'll need modisco for, because in the near feature we want to replace our own persistence layer with JPA, I think we'll use it again
OK, thanks for your hint on JavaUtil, that's exactly what I need
But it would be evennice, if you could give me access to the demo code, til I think it's even faster to adapt this code than implement it from stratch....
Thanks in advance,
Markus
|
|
|
|
|
|
Re: How to manipulate java models once parsed JavaDiscoverer [message #788138 is a reply to message #691480] |
Wed, 01 February 2012 11:48 |
|
Hi Gregoire,
a lot of time gone by, but now I have to finish my task to convert junit3 to junit4.
I migrated to eclipse indigo, and all is working fine,
only one thing I have to fix....
The formatting of the java-code, that results from generating the migrated model is completely different to the origin format....
Before:
/**
* Transferiert eine Workflowsession von User2 auf Frontend2 zu User1 auf Frontend1.
* @throws Exception wenn es doch nicht geklappt hat.
*/
public void testTransfer() throws Exception {
// Sessions erstellen
final FrontendSessionIF fs1 = sessionService.newFrontendSession("fs1");
final FrontendSessionIF fs2 = sessionService.newFrontendSession("fs2");
final UserSessionIF us1 = sessionService.newUserSession(fs1, "rs1");
Afterwards:
/**
* Transferiert eine Workflowsession von User2 auf Frontend2 zu User1 auf Frontend1.
* @throws Exception wenn es doch nicht geklappt hat.
*/
@Test
public void testTransfer() throws Exception{
// Sessions erstellen
final FrontendSessionIF
fs1
=sessionService.newFrontendSession("fs1");
final FrontendSessionIF
fs2
Could you give me please an advice, how to reduce the differences between both?
Best solution would be, that the format is identical beside the changes done from converting.
If this is not possible, I want to format it in a way, that is better than the formatting done.
Would be very kind, if you could help me
Best regards
Markus
|
|
|
Re: How to manipulate java models once parsed JavaDiscoverer [message #789818 is a reply to message #788138] |
Fri, 03 February 2012 12:54 |
Fabien Giquel Messages: 147 Registered: July 2009 |
Senior Member |
|
|
Hi Markus,
"Best solution would be, that the format is identical beside the changes done from converting.
If this is not possible, I want to format it in a way, that is better than the formatting done. "
In fact, java model does not contain orginal format (spaces, tab, line feed) informations, and is not linked to original java files (whereas
However the java generation module (from org.eclipse.gmt.modisco.java.generation) has been completed in order to automatically apply some eclipse jdt/java format (see GenerateJavaExtended class and related) at the end of generation. Obviously in your case it did not work. It may happen for instance if you use an acceleo generation launch configuration with "Java Application" runner instead of "Acceleo plugin Application" one (problem of classpath not completed with the required related java libraries).
Hoping it will help you.
Fabien.
----------------------------------------------------
Fabien GIQUEL
R&D Engineer
Mia-Software
rue Nina Simone
44000 NANTES
----------------------------------------------------
|
|
|
Powered by
FUDForum. Page generated in 0.03744 seconds