[tools] Replacement for ListTool?

Christopher Schultz <[email protected]> Thu, 26 Jun 2014 15:27:52 -0400
Newsgroups gmane.comp.jakarta.velocity.user
Message-ID <[email protected]>
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 like this:

#set($bundleType=$class.inspect($bundle).type)
#if($bundleType &&
$class.inspect('java.util.List').type.isAssignableFrom($bundleType))

[the $bundle object is a List]
#end

But it's kind of verbose, plus I need to check to see if it's an array
as well.

Any suggestions using existing tools?

Thanks,
-chris
signature.asc (application/pgp-signature, 924 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTrHQ4AAoJEBzwKT+lPKRYxnkQALeGsg+Br0YskRwshwtlLEht
8BZ+dJBIDBNBCfViN7qO0SHf6Koc1vLKj13fNeOjMFPB3laLF2AHCrJBWcNg9dd6
ufzD6VBokd+4oj6N4AsMBzozxXj3ztpQI3V5BXnZEo09FPfgjtUGO3vSv3LugCPw
NFwdbK/2YUmAlREQSVbXPbO9pQPh2YuMt3uw9B4QPyLBb+2mbobmGWg5XCFYeTh1
8tZ4od30nv0TgsnpQb7zbR8uNoMuaZ2Vj82qBaHG5geX5s2VLnRa7J1fePViBk5z
dPKM9WVkEVn0Yslor+Yj302nF19pbGru4BTLdBGhkGw5QxGK6DcyTQiER156pcgk
Iue1eafUmnBaRHtNGJV5A0zeKNNjz2QLMP5YFczoKTP0Ajmg70zuftf0mkOpE40u
4cee+kJ8WC3FDYRIBAAS95KVLgkDmQ0skfQmgiiDRy4yVzPFBT2TC4A9u0YC04yr
tCebduG4D5GDlXvbUeC+gpug4CdcWTZDmjudcH3h4TeBaoKoHeQQNsnuYZp0mIbu
wqjaiJmYD33uDe52yh/UbdKE4aNdhorWyKuiVi8hO0n11c770fw2o+UMOAK4DcJm
xGbT7NLVSYR6D9xRsb9A3cr9VjoYxnTBcIFS4ypXsoOyjTCLnXYpU/Lfiu+CYuJP
1Ex1g9EUsi0cGts+78tE
=x9OM
-----END PGP SIGNATURE-----