I would like to make a java object binding that needs to take in javascript properties.
This is the java code I have,
public String name;
public int version;
public void load() {
Context context = Context.newBuilder().allowExperimentalOptions(true).option("js.nashorn-compat", "true").option("engine.WarnInterpreterOnly", "false").allowHostAccess(HostAccess.ALL).build();
context.getBindings("js").putMember("setup", this);
context.eval(Source.newBuilder("js", scriptFile).build());
}
I want to be able to set the name and version variable when the object is defined in javascript using properties like so
var script = setup({
name: "Test",
version: 1
});
How would I be able to get the properties and use them to set these variables? I know in javascript you can do this by putting @property {number} but I don’t know how I would do something like that in java.
