Hello,
I'm just making my first steps with XDoclet(2). First thanks for sharing
this tool.
I tried to to output the creation date in my generated files. The first
attempt was to add velocity-tools-1.2.jar to my classpath and generate -
without any results. The $date tag in the 2nd line of the script is simply
ignored. This is my velocity script:
*** start velocity script ***
#set( $class = $metadata )
//Created on $date
//Created on $date.format('medium',$myObjectName)
public class ${class.getName()} extends ${class.getName()}Standard {}
*** end velocity script ***
Then I thought about providing a date object from my java class to the
script which could be used in line 3 of the velocity script. This is my java
class:
*** start java class ***
import java.util.Date;
import org.generama.QDoxCapableMetadataProvider;
import org.generama.VelocityTemplateEngine;
import org.generama.WriterMapper;
import org.generama.defaults.JavaGeneratingPlugin;
public class EntityClassImplPlugin extends JavaGeneratingPlugin {
public EntityClassImplPlugin(VelocityTemplateEngine
velocityTemplateEngine,
QDoxCapableMetadataProvider metadataProvider,
WriterMapper writerMapper)
throws ClassNotFoundException {
super(velocityTemplateEngine, metadataProvider, writerMapper);
//metadataProvider.getMetadata().add("myDate", new Date());
setMultioutput(true);
}
}
*** end java class ***
In line 16 I tried to provide my data object. Of course this is not
possible. Is there an alternative?
Thanks in advance,
Stefan