Subj : Integrating Java Maps in Rhino To : netscape.public.mozilla.jseng From : Rod Macpherson Date : Tue May 10 2005 09:33 pm This is a multi-part message in MIME format. ------_=_NextPart_001_01C555DA.26760A68 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I understand Java types are accessible from rhino and by extension Java Maps are accessible. I also understand there is no special support that would allow a Map to be used as an associative array in JavaScript. Here is my problem: =20 Consider a string to object Map called colors: =20 colors.put( "red", rouge ); colors.put( "green", seafoam ); colors.put( "blue", aqua ); =20 Say the color objects had a hue property. I would like to access that from JavaScript as follows: =20 var hue =3D colors.red.hue =20 versus: =20 var hue =3D colors.get( "red" ).hue =20 In other words, can I create an associative array in JavaScript or simply an object with a set of named properties from a Java Map? We have some objects with fixed properties and customers who use the scripts are going to be confused as to why the syntax is so radically different for some objects that others. Needless to say these are business folks with zero programming knowledge and we want to make it as simple as possible for them.=20 =20 TIA! =20 =20 =20 ------_=_NextPart_001_01C555DA.26760A68 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

I understand Java types are accessible from rhino and = by extension Java Maps are accessible. I also understand there is no = special support that would allow a Map to be used as an associative array in JavaScript. Here is my problem:

 

Consider a string to object Map called = colors:

 

colors.put( “red”, rouge = );

colors.put( “green”, seafoam = );

colors.put( “blue”, aqua = );

 

Say the color objects had a hue property. I would = like to access that from JavaScript as follows:

 

var hue =3D = colors.red.hue

 

versus:

 

var hue =3D colors.get( “red” = ).hue

 

In other words, can I create an associative array in JavaScript or simply an object with a set of named properties from a = Java Map? We have some objects with fixed properties and customers who use the = scripts are going to be confused as to why the syntax is so radically different for = some objects that others. Needless to say these are business folks with zero programming knowledge and we want to make it as simple as possible for = them.

 

TIA!

 

 

 

------_=_NextPart_001_01C555DA.26760A68-- .