velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Reck <Christoph.R...@dlr.de>
Subject Re: Why cant I pass "arrays" to object methods?
Date Mon, 12 Feb 2001 08:59:48 GMT
> But if I do
> 
> $object.methodB($array) // methodB takes an Object[]
> 
> and I have a method named method in the object "represented" by $object -
> and the method takes an Object[] as a parameter it does not work.

So do:

$object.methodB( $array.toArray() )

Since #set( $array = ["not", "my"] ) due to a recent enhancement
generates an ArrayList.

Geir, I do like the fact that its now an array list, but it will cause
some problems for objects with exisiting methods that are taking Object[]
as a parameters. The above workaround is sufficient. but makes
it hard to do a direct call:
	#set( $list = $tools.split($aStringRef, [$CRLF, $NL, ',']) )
A different solution would have been to allow accessing public fields
directly, e.g.
	$array.length
Just my 2c, and not very important.

:) Christoph

Mime
View raw message