Hullo all,

Great job with Rhino. I have enjoyed using it quite a bit.  My company
has created an open source code generation tool using Rhino called
Hannibal.  You can learn more about it here: 
http://code.google.com/p/hannibalcodegenerator/

I have a question regarding adding properties to a Java object from
within JavaScript.

Consider a Java class that looks like this

package hannibal.domain;

public class Person
{
     private String name;
     public getName() { return name; }
}

In JavaScript I do the following:

var person = new Packages.hannibal.domain.Person();

person.activated = false;  // note that the Person Java class does not
have an "activated" property.

When I try to run this I get an error that tells me that person does
not have an "activated" property.  I would like to be able to
dynamically add properties to a Java object from within JavaScript  Is
this possible?  Is there a configuration item I could set to make this
happen? Or is there a particular design idiom I will need to apply to
get this to work?

I look forward to your replies.

Regards,

Bediako
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to