这个NB~~~!

Constructors in Groovy can be invoked in a classic Java way, but we can also use lists or maps to create objects. Groovy supports an explicit coersion of a list to a constructor with the as keyword. Or we can rely on the implicit coersion when Groovy looks at the type of the variable to automatically convert the list to the right constructor call.

//  Default constructor invocation:
def url1  =   new  URL( ' http ' ' www.mrhaki.com ' 80 ' / ' )
assert   ' http '   ==  url1.protocol
assert   ' www.mrhaki.com '   ==  url1.host
assert   80   ==  url1.port
assert   ' / '   ==  url1.file
assert   ' / '   ==  url1.path

//  Explicit coersion with as keyword:
def url2  =  [ ' http ' ' www.mrhaki.com ' 80 ' / ' ] as URL
assert   ' http '   ==  url1.protocol
assert   ' www.mrhaki.com '   ==  url2.host
assert   80   ==  url2.port
assert   ' / '   ==  url2.file
assert   ' / '   ==  url2.path

//  Implicit coersion by type of variable:
URL url3  =  [ ' http ' ' www.mrhaki.com ' 80 ' / '
assert   ' http '   ==  url3.protocol
assert   ' www.mrhaki.com '   ==  url3.host
assert   80   ==  url3.port
assert   ' / '   ==  url3.file
assert   ' / '   ==  url3.path   

http://mrhaki.blogspot.com/2009/09/groovy-goodness-using-lists-and-maps-as.html