modifying methods of a class with XDoclet

D

denis

Hi,

I've got series of classes (EJBs) which their home & remote interface
are generated by XDoclet1.2.1. And, I'd like to modifiy the ejbCreate
of the EJB method if a specific argument is passed to the ant
instruction.

So I've decided to use :
<template destinationFile="{0}.java"
templateFile="transform-ejb-cmp.xdt" mergeDir="${merge.dir}"/>

My question :
is it possible to have the transform-ejb-cmp.xdt file like that
-->

<XDtEjbComment:comment>
As there is a lot of different file in the project, I only need to
modify the one which are of a CMP entity type
</XDtEjbComment:comment>
<XDtEjbCmp:ifEntity>
[here I need to recopy all the stuff from the original file to
the last line of ejbCreate()]
// several specific java instruction
System.out.println("test");
[here I need to recopy all the stuff from the original file to
the last line of ejbCreate() to the last line of file]
</XDtEjbCmp:ifEntity>


Another solution was to take original entity-cmp.xdt files and
modify then but it doesn't fit my needs cause the process for this
subtask is treating only files ending with CMP moreover I only need to
modify the ejbCreate method and the original entity-cmp.xdt file
modify a lot of other things like methods signature, extension of
class and so on.

Have you got any clues wich could help me in resolving this issue
?

Thanks a lot for all you can do.

Regards,
blured.




The following EJB class is originally like that :

package ....
....

public abstract class Toto implements EntityBean {
....
....

/**
*
*
*/
public abstract ejbCreate() {
setId(1);
setToto("3");
}
....
}

The result file I'd like to have is :

package ....
....

public abstract class Toto implements EntityBean {
....
....

/**
*
*
*/
public abstract ejbCreate() {
setId(1);
setToto("3");

// several specific java instruction
System.out.println("test");
}
....
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top