java Nashorn 中的默认方法是在实际方法不存在时调用的吗?

Is the a default method in java Nashorn which is invoked when the actual method is not present?

我正在 Java 的 Nashorn java 脚本引擎中寻找一些东西,当找不到实际方法时,它会调用通用方法作为后备。

它应该类似于 groovy 的 methodMissinginvokeMethod 功能。

有这样的吗?

我尝试使用 java Proxy,但是 InvocationHandler 只会被接口中的方法调用...而我想要类似 InvocationHandler 的东西任何方法都应该调用它。

查看 noSuchMethod 功能 documented here。还有一个 noSuchProperty 挂钩,用于对属性和变量执行相同的操作。