Re: [tools] Replacement for ListTool?

2014-06-26 Thread Sergiu Dumitriu
Oh, I misread, I thought that you want to distinguish between arrays and lists, but you want to detect both arrays and lists from any other type of objects. Then yes, you need to check if the object is an instance of java.util.List. Alternatively, a simpler, but not 100% safe check is to check if

Re: [tools] Replacement for ListTool?

2014-06-26 Thread Christopher Schultz
Sergiu, On 6/26/14, 3:34 PM, Sergiu Dumitriu wrote: > This should work without any tools: > > $bundleType.class.getName().startsWith('[') Oh, that's cool.. but it doesn't check for java.util.List (I'd need to either do the ugliness I have below, or check for each expected List implementation whi

Re: [tools] Replacement for ListTool?

2014-06-26 Thread Sergiu Dumitriu
This should work without any tools: $bundleType.class.getName().startsWith('[') On 06/26/2014 03:27 PM, Christopher Schultz wrote: > All, > > ListTool is marked as deprecated because Velocity 1.6 and later treat > arrays and lists as first-class collections and can perform appropriate > operatio

[tools] Replacement for ListTool?

2014-06-26 Thread Christopher Schultz
All, ListTool is marked as deprecated because Velocity 1.6 and later treat arrays and lists as first-class collections and can perform appropriate operations on them. One thing it's not easy to do is determine if an object is an List or an Array. I have something hacked-together using ClassTool