I'm adding (changing) Velocity so that it will support Comparable objects
for >, >= , ==, <= , < rather than simply Integers and objects of the same
class.
Is this some great crime? Would this be of interest to Others?
I'm going to do this anyway, and if anyone else would like it, they can
e-mail me.
I'm doing it because my internal scripting language has a runtime-typed
value, and I want to be able to use the comparison operators as well as
something like "contains()" on the values passed to Velocity.
Currently if you do $var.contains("thing") and var is a string, Velocity
seems to silently ignore the error and simply continues.
My code replaces the runtime/parser/node/AST[EQ, GT, GE, LT, LE]Node.java
and I added a Comparator class with static methods in util.
Comparator can be extended for "special cases" if we like. Currently it
casts the Object parameters to Comparable and does a left.compareTo(right).
It'll throw a ClassCastException as appropriate, the Node classes catch the
exception and log the error.
And if no one is interested, I'm curious as to why it's a problem.
Thanx!
Best Regards,
Will Hartung
([EMAIL PROTECTED])
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>