You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Walter Vaughan <wv...@steelerubber.com> on 2006/08/31 17:03:44 UTC

UtilMisc.toMap wierdness

Help!

Is there a limit to the number of items that can be used with
UtilMisc.toMap? When we give it more than 7 pairs it fails to compile.
We can mix and match what pairs we give and it works, it just won't work with
more than 7 pairs.

Thanks

--
Walter



RE: UtilMisc.toMap wierdness

Posted by Chris Howe <cj...@yahoo.com>.
Thanks Vinay!  Saved me from testing it out myself :) 
I'm always looking for ways to limit the kinds of
hammers I keep around when all I have actually are
nails (always looking to butcher metaphors as well)

--- Vinay Agarwal <Vi...@hotmail.com> wrote:

> I have extensively used "UtilMisc.toMap(new Object[]
> {key1, val1, key2,
> val2, ...})" version of the function to create maps
> with large number of
> parameters. It works well.
> 
> Regards,
> Vinay Agarwal
> 
> 
> -----Original Message-----
> From: Chris Howe [mailto:cjhowe76013@yahoo.com] 
> Sent: Thursday, August 31, 2006 12:56 PM
> To: ofbiz-user@incubator.apache.org
> Subject: Re: UtilMisc.toMap wierdness
> 
> actually, it does already.  the 7th toMap method
> accepts an even object
> array and returns the map. I would test it though. 
> It looks to skip the
> Object[0].
>  
> 
> --- Walter Vaughan <wv...@steelerubber.com>
> wrote:
> 
> > Jacques Le Roux wrote:
> > 
> > > This is due to Java limitation in arguments
> > number. You may create your own toMap() method in
> UtilMisc.Java...
> > 
> > Thanks everyone...
> > 
> > As complete newbies in "OFBiz think" it seemed
> impossible that there 
> > was a hard coded upper limit. Of course two of the
> guys want to 
> > rewrite it so that it would accept 1 to infinity-1
> number of 
> > arguments.
> > 
> > We'll save that for an other day...
> > 
> > --
> > Walter
> > 
> 
> 
> 


RE: UtilMisc.toMap wierdness

Posted by Vinay Agarwal <Vi...@hotmail.com>.
I have extensively used "UtilMisc.toMap(new Object[] {key1, val1, key2,
val2, ...})" version of the function to create maps with large number of
parameters. It works well.

Regards,
Vinay Agarwal


-----Original Message-----
From: Chris Howe [mailto:cjhowe76013@yahoo.com] 
Sent: Thursday, August 31, 2006 12:56 PM
To: ofbiz-user@incubator.apache.org
Subject: Re: UtilMisc.toMap wierdness

actually, it does already.  the 7th toMap method accepts an even object
array and returns the map. I would test it though.  It looks to skip the
Object[0].
 

--- Walter Vaughan <wv...@steelerubber.com> wrote:

> Jacques Le Roux wrote:
> 
> > This is due to Java limitation in arguments
> number. You may create your own toMap() method in UtilMisc.Java...
> 
> Thanks everyone...
> 
> As complete newbies in "OFBiz think" it seemed impossible that there 
> was a hard coded upper limit. Of course two of the guys want to 
> rewrite it so that it would accept 1 to infinity-1 number of 
> arguments.
> 
> We'll save that for an other day...
> 
> --
> Walter
> 



Re: UtilMisc.toMap wierdness

Posted by David E Jones <jo...@undersunconsulting.com>.
This isn't really a weird thing, they are just java methods and when  
calling a java method you have to have a fixed set of parameters  
going in. I guess if you're not used to java then it might seem funny.

-David


On Aug 31, 2006, at 1:04 PM, Walter Vaughan wrote:

> Jacques Le Roux wrote:
>
>> This is due to Java limitation in arguments number. You may create  
>> your own toMap() method in UtilMisc.Java...
>
> Thanks everyone...
>
> As complete newbies in "OFBiz think" it seemed impossible that  
> there was a hard coded upper limit. Of course two of the guys want  
> to rewrite it so that it would accept 1 to infinity-1 number of  
> arguments.
>
> We'll save that for an other day...
>
> --
> Walter


Re: UtilMisc.toMap wierdness

Posted by Chris Howe <cj...@yahoo.com>.
actually, it does already.  the 7th toMap method
accepts an even object array and returns the map. I
would test it though.  It looks to skip the Object[0].
 

--- Walter Vaughan <wv...@steelerubber.com> wrote:

> Jacques Le Roux wrote:
> 
> > This is due to Java limitation in arguments
> number. You may create your own toMap() method in
> UtilMisc.Java...
> 
> Thanks everyone...
> 
> As complete newbies in "OFBiz think" it seemed
> impossible that there was a hard 
> coded upper limit. Of course two of the guys want to
> rewrite it so that it would 
> accept 1 to infinity-1 number of arguments.
> 
> We'll save that for an other day...
> 
> --
> Walter
> 


Re: UtilMisc.toMap wierdness

Posted by Walter Vaughan <wv...@steelerubber.com>.
Jacques Le Roux wrote:

> This is due to Java limitation in arguments number. You may create your own toMap() method in UtilMisc.Java...

Thanks everyone...

As complete newbies in "OFBiz think" it seemed impossible that there was a hard 
coded upper limit. Of course two of the guys want to rewrite it so that it would 
accept 1 to infinity-1 number of arguments.

We'll save that for an other day...

--
Walter

Re: UtilMisc.toMap wierdness

Posted by Jacques Le Roux <ja...@les7arts.com>.
This is due to Java limitation in arguments number. You may create your own toMap() method in UtilMisc.Java...

Jacques
 
----- Original Message ----- 
From: "Walter Vaughan" <wv...@steelerubber.com>
To: <of...@incubator.apache.org>
Sent: Thursday, August 31, 2006 5:03 PM
Subject: UtilMisc.toMap wierdness


> Help!
> 
> Is there a limit to the number of items that can be used with
> UtilMisc.toMap? When we give it more than 7 pairs it fails to compile.
> We can mix and match what pairs we give and it works, it just won't work with
> more than 7 pairs.
> 
> Thanks
> 
> --
> Walter
> 

Re: UtilMisc.toMap wierdness

Posted by Andrew Sykes <an...@sykesdevelopment.com>.
Walter,

just use the normal java method to add more...

myMap.put("key",value);

- Andrew

On Thu, 2006-08-31 at 11:03 -0400, Walter Vaughan wrote:
> Help!
> 
> Is there a limit to the number of items that can be used with
> UtilMisc.toMap? When we give it more than 7 pairs it fails to compile.
> We can mix and match what pairs we give and it works, it just won't work with
> more than 7 pairs.
> 
> Thanks
> 
> --
> Walter
> 
> 
-- 
Kind Regards
Andrew Sykes <an...@sykesdevelopment.com>
Sykes Development Ltd
http://www.sykesdevelopment.com


Re: UtilMisc.toMap wierdness

Posted by Chris Howe <cj...@yahoo.com>.
UtilMisc.java toMap only takes six name/value pairs. 
If you're needing more just follow the convention used
in the sixth toMap method and recompile.

--- Walter Vaughan <wv...@steelerubber.com> wrote:

> Help!
> 
> Is there a limit to the number of items that can be
> used with
> UtilMisc.toMap? When we give it more than 7 pairs it
> fails to compile.
> We can mix and match what pairs we give and it
> works, it just won't work with
> more than 7 pairs.
> 
> Thanks
> 
> --
> Walter
> 
> 
>