Class UnknownJavaClass

The java instance proxy class. This class actually does all the magic. After it is created, this will just be a constructor with all static methods and properties (the accessible ones) stored in it and ready for use. Once the actual instance using the new operator is created, a new java_instance_proxy instance is created, containing the actual java instance (that thing isn't visible though) and all (visible) non-static class member methods and properties.

Hierarchy (view full)

Indexable

[member: string]: any

Any class member imported. We'll need to use 'any' as any is callable. The actual type would be JavaType | ((...args: JavaType[]) => JavaType | Promise). Just throwing it out there.

Constructors

Properties

class.proxy: JavaClassProxy

The class proxy class instance

Accessors

Methods

  • Check if this is an instance of another class. Pass either the name of the other class or the class itself to check if this is an instance of it. Does not overwrite any existing instanceof operator. This uses the native java instanceof operator.

    This method's name is not affected by the JavaConfig#syncSuffix and JavaConfig#asyncSuffix options.

    Example

    import { importClass } from 'java-bridge';

    const JavaString = importClass('java.lang.String');
    const str = new JavaString('Hello World');

    str.instanceOf(JavaString); // true
    str.instanceOf('java.lang.String'); // true
    str.instanceOf('java.lang.Object'); // true
    str.instanceOf('java.lang.Integer'); // false

    Type Parameters

    • T extends object

    Parameters

    • other: string | T

      the class to check if this is an instance of

    Returns boolean

    true if this is instance of other

Generated using TypeDoc