velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shinobu Kawai <shinobu.ka...@gmail.com>
Subject Re: creating new instances
Date Sat, 04 Sep 2004 15:07:34 GMT
Hi Larry,

> We are writing Velocity (actually DVSL) macros for a framework in which we
> have no access to any of the Java source code.  I'm looking for a hack
> that will allow me to create instances of classes that I write myself and
> place in the classpath.
Okay, then how about this?

## $dummy can be anything so long as it's an object
#set($dummy = "")
#set($foo = $dummy.class.forName("java.lang.StringBuffer").newInstance())
$foo.append("Hello ").append($bar).append("!")

This says hello to whatever is in $bar.

Best regards,
-- Shinobu Kawai

-- 
Shinobu Kawai(shinobu.kawai@gmail.com)

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message