You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Stephen Riek <st...@yahoo.co.uk> on 2002/04/08 04:38:43 UTC

why no StringBufferResourceLoader ?

I'm intrigued. Velocity supports a FileResourceLoader, DataSourceResourceLoader, ClasspathResourceLoader and even JarResourceLoader  but why is there no mechanism for using a simple String or StringBuffer object. I would have thought it most useful and convenient, but presume that there is a design reason for not including it ?

Stephen.



---------------------------------
Do You Yahoo!?
Get personalised at My Yahoo!.

Re: why no StringBufferResourceLoader ?

Posted by Stephen Riek <st...@yahoo.co.uk>.
  "Geir Magnusson Jr." <ge...@optonline.net> wrote: 
> > 
> > I'm intrigued. Velocity supports a FileResourceLoader,
> > DataSourceResourceLoader, ClasspathResourceLoader and even JarResourceLoader
> > but why is there no mechanism for using a simple String or StringBuffer
> > object. I would have thought it most useful and convenient, but presume that
> > there is a design reason for not including it ?
> 
> Making a formal loader for a StringBuffer doesn't make too much sense, as
> the concept of a loader is such that it *loads* template from a source.

Aaah, now I understand. 

> However, the application API supports you supplying a String, InputStream or
> Reader as the source of the template, which I think is what you are looking
> for.

Yes, that's what I'm looking for. 

> See the evaluate() methods in class org.apache.velocity.app.Velocity (if you
> are using the singleton model) or o.a.v.app.VelocityEngine (if you are using
> the 'separate instance' model.)

Thanks a lot Geir, 

Stephen.



---------------------------------
Do You Yahoo!?
Get personalised at My Yahoo!.

Re: why no StringBufferResourceLoader ?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 4/7/02 10:38 PM, "Stephen Riek" <st...@yahoo.co.uk> wrote:

> 
> I'm intrigued. Velocity supports a FileResourceLoader,
> DataSourceResourceLoader, ClasspathResourceLoader and even JarResourceLoader
> but why is there no mechanism for using a simple String or StringBuffer
> object. I would have thought it most useful and convenient, but presume that
> there is a design reason for not including it ?

Making a formal loader for a StringBuffer doesn't make too much sense, as
the concept of a loader is such that it *loads* template from a source.

However, the application API supports you supplying a String, InputStream or
Reader as the source of the template, which I think is what you are looking
for.

See the evaluate() methods in class org.apache.velocity.app.Velocity (if you
are using the singleton model) or o.a.v.app.VelocityEngine (if you are using
the 'separate instance' model.)

Geir

-- 
Geir Magnusson Jr.                       geirm@optonline.net
System and Software Consulting
You're going to end up getting pissed at your software
anyway, so you might as well not pay for it. Try Open Source.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>