Interface JavaInterfaceProxy<T>

The class for implementing java interfaces. Keep this instance in scope to not destroy the java object. Call reset to instantly destroy this instance.

Notes

Keeping this instance alive may cause your process not to exit early. Thus, you must wait for the javascript garbage collector to destroy this instance even if you called reset.

Once this instance has been destroyed, either by calling reset or the garbage collector, any call to any method defined earlier by newProxy will throw an error in the java process.

Example

import { newProxy } from 'java-bridge';

const proxy = newProxy('path.to.MyInterface', {
// Define methods...
});

// Do something with the proxy
instance.someMethod(proxy);

// Destroy the proxy
proxy.reset();

See also

interface JavaInterfaceProxy<T> {
    _dummy?: T;
    reset(force?): void;
}

Type Parameters

Properties

Methods

Properties

_dummy?: T

A dummy property to make sure the type is correct. This property will never be set.

Methods

  • Destroy the proxy class. After this call any call to any method defined by the interface will throw an error on the java side. This error may be thrown back to the node process, if you are not specifically implementing methods that will be called from another (java) thread. Throws an error if the proxy has already been destroyed.

    Parameters

    • Optional force: boolean

      whether to force the destruction of the proxy if it should be kept alive as a daemon

    Returns void

Generated using TypeDoc