Java アプリケーションに Mozilla Rhino (JavaScript エンジン) を使用しています。次のように ScriptableObject を定義しました。
public class TheObj extends ScriptableObject {
public TheObj(){
//nothing
}
public TheObj(Scriptable scope, Scriptable prototype) {
super(scope, prototype);
}
@Override
public String getClassName() {
return "Foo";
}
@JSStaticFunction
public static Foo foo(Foo foo){
return foo;
}
}
Foo クラスは次のとおりです。
public class Foo {
public void bar(){
System.out.println("it works");
}
}
しかし、Scriptable がScriptableObject.defineClass(scope, TheObj.class);
どこにあるのかを試してみると、スローされますscope
Context.enter().initStandardObjects();
org.mozilla.javascript.EvaluatorException: Unsupported parameter type "Foo" in method "bar".
これを修正するにはどうすればよいですか?