Oh ok I see what you mean, if you do it like this:
partyId = parameters.partyId;
context[partyId] = [Key1:"Value1"];

or like this
testMap = [(partyId):[Key1:"Value1"]];

-Scott

2008/6/7 Ashish Vijaywargiya <[EMAIL PROTECTED]>:

> Scott and Chanwit thanks for your reply.
> I think we have deviated from my question ..... reason may be I didn't ask
> it in proper way.
>
> Let me explain it in some other way :-
>
> >>Suppose I have two sentence in Beanshell file :-
> >>1). context.put("partyId" , UtilMisc.toMap("Key1","Value1"));
>
> I am saying that here you are putting the "partyId" as the "key" in the
> context map and its value will be  UtilMisc.toMap("Key1","Value1").
> I am fine with its Groovy conversion.
> The converted groovy sentence for above will be  :-
>  context.partyId = [Key1 : "Value1"];
>
> >>Key i.e partyId in the following sentence will be variable one.
> >>2).  partyId = parameters.get("partyId") ;
> I only wrote the above line to tell that we can get variable value in
> partyId.
> >>context.put(partyId , UtilMisc.topMap("Key1","Value1"));
>
> In the above sentence you are putting the "value" (that will be variable)
> of
> partyId as the "key" and it can be either String or number and then the
> value of it will be same i.e UtilMisc.topMap("Key1","Value1")).
> And if we put the groovy conversion of it as same as that of first one in
> the context then what will be the difference in both the scenario.
>
> Please let me know if my explaination is again not to the point.
>
> --
> Ashish
>
>
>
> On Sat, Jun 7, 2008 at 4:56 AM, Chanwit Kaewkasi <[EMAIL PROTECTED]>
> wrote:
>
> > Hello Scott,
> >
> > You're right. I've confirmed with a compiled class.
> >
> > Anyway, IMHO it's a good practice to use single quotes for a string.
> >
> > Cheers,
> >
> > Chanwit
> >
> > 2008/6/7 Scott Gray <[EMAIL PROTECTED]>:
> > > A string enclosed in double quotes only becomes a GString if it
> contains
> > an
> > > ${...} expression otherwise single and double quotes are both treated
> as
> > > Strings.
> > > http://groovy.codehaus.org/Strings#Strings-GStrings
> > >
> > > - Scott
> > >
> > > 2008/6/7 Chanwit Kaewkasi <[EMAIL PROTECTED]>:
> > >
> > >>
> > >> ps. single quote is for String, while double quote is for Groovy's
> > String.
> > >>
> > >> 2008/6/7 Scott Gray <[EMAIL PROTECTED]>:
> > >> > Do you mean like this:
> > >> > partyId = parameters.partyId;
> > >> > context.partyId = [Key1 : "Value1"];
> > >> >
> > >> > - Scott
> > >> >
> > >> > 2008/6/7 Ashish Vijaywargiya <[EMAIL PROTECTED]>:
> > >> >
> > >> >> Frenz ,
> > >> >>
> > >> >> Suppose I have two sentence in Beanshell file :-
> > >> >>
> > >> >> 1). context.put("partyId" , UtilMisc.toMap("Key1","Value1"));
> > >> >>
> > >> >> Key i.e partyId in the following sentence will be variable one.
> > >> >> 2).  partyId = parameters.get("partyId") ;
> > >> >> context.put(partyId , UtilMisc.topMap("Key1","Value1"));
> > >> >>
> > >> >> The converted sentence for the Beanshell statement shown above will
> > be
> > >> :-
> > >> >>
> > >> >> 1) context.partyId = [Key1 : "Value1"];
> > >> >>
> > >> >> And I am confused about the second one.
> > >> >> Can anybody of you give some pointer on it ?
> > >> >>
> > >> >> --
> > >> >> Ashish Vijaywargiya
> > >> >>
> > >> >
> > >>
> > >
> >
>

Reply via email to