tags:

views:

191

answers:

2

Hi I want to find out whether a variable is an array or not

  if (params.writtenLines == ???)

much appreicated.

+2  A: 

This functionality is already available in pure Java and can therefore be used in Groovy, too:

if (params.writtenLines.class.isArray())
Christoph Metzendorf
Thanks dude, I found this as wellif ( params.writtenLineID.getClass().isArray())Keep up the good work cheers.
WaZ
+1  A: 

More importantly, why do you want to check whether it's an array? If you know the parameter might be a single string or a list, you can now use:

def lines = params.list("writtenLines")

That came with Grails 1.2.

Peter Ledbrook
I havent tried that yet,thanks for sharing.
WaZ