Java / Nashorn put one function in binding / global scope
<p>I have one static method like:</p>

<pre><code>some abstract class C {
    void dump( Object o ) {
}
</code></pre>

<p>which I'd like to pass to js that I can use it directly in the global scope like:</p>

<pre><code>js&gt; dump( new Something() );
</code></pre>

<p>So far the only way I found is creating an instance like</p>

<pre><code>public class CStub {
    void dump( Object o ){ C.dump( o ); }
}
</code></pre>

<p>putting it in nashorn via:</p>

<pre><code>engine.put( "stub", new CStub() );
</code></pre>

<p>and then in js:</p>

<pre><code>js&gt; var dump = stub.dump
</code></pre>

<p>but is there another approach to this which doesn't involve the stub creation and puts the method directly in the global scope?</p>