Since you have that DateTool class as a template object you'd need to retrieve the date by doing something like this in your template:

$date.date (since the name attribute on the templateObject is the name of the variable that will be made available to your template containing the DateTool instance)

Jim Otte wrote:

Chad,

Thank you for the suggestion- but I am modifying a
template in the java cartridge provided- in the
ValueObject.vsl. I would like to add a line that has
the date.
I added as you suggested a template object as such in
the andromda-cartridge.xml:

   <templateObject name="date"
className="org.apache.velocity.tools.generic.DateTool"/>

But still get no output- even with that jar in the
lib- I do not have a generic class for the Date- that
is why I was using VelocityTools (or trying to)...

Any ideas welcome-Thanks,
jim


--- Chad Brandon <[EMAIL PROTECTED]> wrote:


You don't need to use any velocity tools jar to
output the date, you can just use any simple java object that has a default
constructor, and add a getDate() method to it. It just needs to be added
as a <templateObject/> in the andromda-cartridge.xml, for
example:


<templateObject name="dateUtils" className="my.cartridge.package.DateUtils"/>

and then just do:

$dateUtils.date

within your template.

Chad

Jim Otte wrote:



I have the following question: I have modified one


of


the velocity templates in the Java Cartridge to


output


some custom documentation in the classes generated.
In the doc. I would like the date that the class is
generated on in the documentation.
I see that for Velocity templates this is done by
using the VelocityTools .jar and putting something
like this (these are all the combinations I have
tried):

* Data Object- Persistable.
* $date
* $getDate()
* $date.medium
* $class.abstract
*


$org.apache.velocity.tools.generic.DateTool.getDate()


* $org.apache.velocity.tools.generic.DateTool.date
* $org.apache.velocity.tools.generic.DateTool
*

I always get this though:
* Data Object- Persistable.
* $date
* $getDate()
* $date.medium
* true
*


$org.apache.velocity.tools.generic.DateTool.getDate()


* $org.apache.velocity.tools.generic.DateTool.date
* $org.apache.velocity.tools.generic.DateTool
*


The date method does not seem to get called- I have
placed velocity-tools-1.1.jar just about everywhere and no
luck.
Has anybody been able to use VelocityTools with the
Velocity templates in the cartridges?




Thanks,
Jim




__________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/





-------------------------------------------------------


SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT


Products from real users.


Discover which products truly live up to the hype.


Start reading now.

http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click


_______________________________________________
Andromda-user mailing list
[email protected]


https://lists.sourceforge.net/lists/listinfo/andromda-user











__________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/







------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Andromda-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/andromda-user

Reply via email to