make code more readable by introducing a local variable and remove 10+ casts
merge two identical if branches
[#1813] use element's own class when unbinding array elements so that directUnbind would be possible for them

Previously, array's getComponentType() was used, which is often the java.lang.Object (if coming from Groovy or a converted Collection),
not the real class, so unbinding it doesn't work at all. Need to provide the real element's class instead.
it seems that these tests require java 1.6 source level
add test for unbinding of arrays - it checks if array is present at all in the reversed url
Merge pull request #755 from codeborne/unbinder_fix

[#1813] Regression: fix unbinding of collections and arrays from Groovy templates