Is it possible to make an Java object the prototype of a JavaScript object? Like the following:
var Person = Java.type("Person");
var hans = new Person();
hans.name = "Hans";
var employeeFactory = function() {
var F = function(){};
F.prototype = hans;
return new F();
};
var fritz = employeeFactory();
print(fritz.name);
Here Person is a Java Bean. The variable hans is set as the instance of this Java class. The line hans.name = "Hans" sets the name field in the Java object as expected. But when the object fritz is created in the factory function, it doesn't get linked to the expected prototype. Is there any reason why the Java instance isn't accepted as prototype?
Object.create?