On 4/10/07, Henning P. Schmiedehausen <[EMAIL PROTECTED]> wrote:
"Nathan Bubna" <[EMAIL PROTECTED]> writes:
>On 4/8/07, Henning P. Schmiedehausen <[EMAIL PROTECTED]> wrote:
>> [EMAIL PROTECTED] writes:
>>
>> While I hope to grasp the intention of this patch; why can't you wrap
>> the Array into Arrays.asList(), which does turn an array into a fixed
>> size list?
i should have asked this the first time, but where do you see this
wrapping happening?
>i believe that would break $object.expectsArray($array)
No it does not. But it breaks in better ways. ;-)
having trouble parsing this paragraph...
Actually, the primitive types are the problem. For Object arrays, using asArray
is a piece of cake. However, for simple types, you can not cast to Object [], so
Arrays.asArray is out of the question, but I tried this abomination:
if (Object [].class.isAssignableFrom(klass))
{
return Arrays.asList((Object []) obj);
} else if (boolean [].class.isAssignableFrom(klass))
{
return Arrays.asList(ArrayUtils.toObject((boolean []) obj));
} else [... all primitives to short ...]
}
where are you putting this code?
which *does* work until you get to your primitive setter test. The
ArrayUtils.toObject method created a new array on the fly which
contains the primitive values as objects. And the setters change the
object but not the corresponding primitive. So this test fails and I
see no quick way of fixing.
if you can get it to work, i'm definitely open to other
implementations. my only concern is to enable this functionality (and
more if possible).
I still hate the implementation of the Array Method; this must be
easier/more elegant to implement. Will have to think about this,
though. Something like an array proxy that implements List and
converts on the fly. Having a separate VelArrayMethod feels wrong.
would it help to call it VelPretendMethod? ;-)
when i get a little more time to re-read the above (and your answers
to my questions about it), i'll see if i can't come up with something
more palatable to you. :) right now, i'm a little brain-fried.
Best regards
Henning
--
Henning P. Schmiedehausen -- [EMAIL PROTECTED] | J2EE, Linux,
|gls
91054 Buckenhof, Germany -- +49 9131 506540 | Apache person |eau
Open Source Consulting, Development, Design | Velocity - Turbine guy |rwc
|m k
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH - RG Fuerth, HRB 7350 |a s
Sitz der Gesellschaft: Buckenhof. Geschaeftsfuehrer: Henning Schmiedehausen |n
"Save the cheerleader. Save the world."
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]