velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Rall <>
Subject Re: [VOTE] RESULT XxxUtils constructors
Date Wed, 21 Aug 2002 01:59:48 GMT
"Stephen Colebourne" <> writes:

> Thanks for the clarification. Now we know that XxxUtils in commons is
> incompatable with Velocity as it stands. Thus the options are
> - change Velocity
> - change commons
> - tough (fork code)
> I voted last time, at least in part, on the belief that Velocity could find
> a way around this. So, I would now reconsider my vote.
> Daniel - can you clarify why this change to Velocity is unacceptable?:
> context.putStatic(StringUtils.class)
> [note the 'static' to indicate to use static methods, not an instance]

IMO, that's pretty unacceptable (but I'm obviously not the only
committer ;).  In Velocity, the right way to handle this sort of thing
is via a custom introspector which can be plugged into Velocity
through its configuration.  This introspector would look for instances
of a wrapper class which is responsible for invoking methods of the
class represented by Class object (the wrapper class would actually be
unnecessary when coupled with the customer introspector, but better
for compatibility's sake).  Here's some very vague pseudo-code:

class Invoker
    Invoker(Class c):

class CustomIntrospector:
    doIntrospectionStuff(Object obj, String methodName):
        if (obj instanceof Invoker):
            ((Invoker) obj).invokeMethod(methodName)
            // Do standard Velocity invoker stuff

It's even remotely possible that Geir and the gang might consider
including a patch providing this sort of functionality in the core,
since it doesn't negatively effect backwards compat.

Daniel Rall <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message