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 |
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 <[hidden email]> 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 > > > |
Administrator
|
In reply to this post by Walter Vaughan
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" <[hidden email]> To: <[hidden email]> 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 > |
In reply to this post by Walter Vaughan
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 <[hidden email]> Sykes Development Ltd http://www.sykesdevelopment.com |
In reply to this post by Jacques Le Roux
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 |
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 |
In reply to this post by Walter Vaughan
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 <[hidden email]> 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 > |
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:[hidden email]] Sent: Thursday, August 31, 2006 12:56 PM To: [hidden email] 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 <[hidden email]> 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 > |
In reply to this post by Walter Vaughan
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 <[hidden email]> 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:[hidden email]] > Sent: Thursday, August 31, 2006 12:56 PM > To: [hidden email] > 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 <[hidden email]> > 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 > > > > > |
Free forum by Nabble | Edit this page |