commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Rall <...@finemaltcoding.com>
Subject Re: StringUtils constructor is private
Date Mon, 12 Aug 2002 21:38:04 GMT
"Stephen Colebourne" <scolebourne@btopenworld.com> writes:

> From: "Daniel Rall" <dlr@finemaltcoding.com>
> > "Stephen Colebourne" <scolebourne@btopenworld.com> writes:
> > > But given Velocity is broken, I suppose we have to do something. Either
> a
> > > public constructor or a public static final instance variable 'INSTANCE'
> > > would do. But I hate the very thought of it. And it affects all of
> > > [collections], [pattern and [lang].
> >
> > Velocity is not broken -- it simply requires a class instance to
> > reference methods of that class.  Valid in Java, valid in Velocity.
> 
> But Velocity shouldn't require the class instance. Reflection doesn't.
> Something like:
>  context.putStatic("foo", StringUtils.class);
>  #set ($bar = $foo.chomp())

In your example, there is no way to know whether you want to invoke
methods of the Class instance you added to the context, or methods of
the class which it represents.

That's why I suggested the following wrapper (which may even exist,
for all I know):

<repeat>
What would be really convenient is a class with hooks into the
Velocity internals which takes a Class object in its constructor and
invokes methods via reflection (much as Velocity does anyhow), using
Velocity's internal introspection and/or uberspection caches.
</repeat>
-- 

Daniel Rall <dlr@finemaltcoding.com>

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message