Class JavaClassConstructor

A java class constructor class

See

JavaClass

Hierarchy (view full)

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