On Mon, Mar 10, 2008 at 1:12 PM, Christopher Schultz <[EMAIL PROTECTED]> wrote: > All, > > This is a bit more of a "users" list question, but I think it will > evolve into a dev discussion, so I'm posting it here. > > I have a List that I'd like to remove objects from. java.util.List > implements two "remove" methods: one that accepts an (int) index into > the list and one that accepts a list element (java.lang.Object). > > My list elements are java.lang.Integer objects, so in the eyes of > Velocity, there is an ambiguity, here.
eek. > Velocity happens to pick > remove(int) when I'd prefer remove(Object) in my case. but would you prefer that in general? i'm guessing not. i think Velocity is doing the right thing here and suspect you'd agree. > Is there a way to force Velocity to pick a particular version of a > method? In Java, you'd just cast the object to a particular class to > remove any ambiguity, but that option is not available for Velocity. no, and i can't think of any easy way to do it with adding syntax for casting or making it so the Uberspect does the "generally wrong" thing here. and i think i'd oppose either of those, the first on grounds of barely useful complication and the latter because it would be backwards incompatible and i think not fit the general use-case. i suppose you could hack up a custom Uberspect or Introspector that watches for this special case and use that for your application, but that seems ugly. > Any suggestions? i'd suggesting looking for another way to have your template do as you wish. removeAll(Collection)? a tool? something else entirely? > -chris > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
