WebUI X Documentation
    Preparing search index...

    Represents a bridge to interact with Java objects from JavaScript/TypeScript.

    The JavaObject class provides static and instance methods to create, manipulate, and release Java objects via a reflection interface, typically exposed by a global context (e.g., wx:reflect module). It supports calling methods, accessing fields, and creating Java proxies with JavaScript handlers.

    • Instantiate with a Java class name and constructor arguments to create a new Java object.
    • Use call to invoke Java methods, get and set to access fields.
    • Use static methods for advanced operations or to create proxies.
    • reflect: The reflection interface for Java interop.
    • proxyHandlers: Internal map for proxy handler functions.
    • nextProxyId: Counter for generating unique proxy handler IDs.
    • classId: The Java class identifier.
    • objId: The Java object identifier.
    • constructor(className, args): Creates a new Java object.
    • call(method, args): Calls a Java method.
    • get(field): Gets a Java field value.
    • set(field, value): Sets a Java field value.
    • release(): Releases the Java object.
    • getClass(name): Gets a Java class ID.
    • newInstance(classId, args): Creates a new Java object instance.
    • callMethod(objId, method, args): Calls a method on a Java object.
    • getField(objId, field): Gets a field value from a Java object.
    • setField(objId, field, value): Sets a field value on a Java object.
    • release(objId): Releases a Java object.
    • fromObjId(objId): Creates a JavaObject from an existing object ID.
    • createProxy(interfaceName, handler): Creates a Java proxy object with a JavaScript handler.

    If the required global context or reflection module is not available.

    For invalid arguments in methods.

    Index

    Constructors

    • Parameters

      • className: null | string
      • Optionalargs: (string | number | boolean)[]

      Returns JavaObject

    Properties

    classId: any
    objId: any
    nextProxyId: number
    proxyHandlers: Map<any, any>
    reflect: undefined | Reflect

    Methods

    • Parameters

      • method: string
      • Optionalargs: (string | number | boolean)[]

      Returns undefined | null | string

    • Parameters

      • field: string

      Returns undefined | null | string

    • Returns void

    • Parameters

      • field: string
      • value: null | string | number | boolean

      Returns void

    • Parameters

      • objId: string
      • method: string
      • args: null | (string | number | boolean)[]

      Returns undefined | null | string

    • Parameters

      • objId: string
      • method: string
      • args: null | (string | number | boolean)[]

      Returns undefined | null | string

    • Parameters

      • interfaceName: any
      • handler: any

      Returns JavaObject

    • Parameters

      • objId: undefined | null | string

      Returns JavaObject

    • Parameters

      • name: string

      Returns undefined | null | string

    • Parameters

      • objId: string
      • field: string

      Returns undefined | null | string

    • Parameters

      • classId: string
      • args: null | (string | number | boolean)[]

      Returns undefined | null | string

    • Parameters

      • objId: string

      Returns void

    • Parameters

      • objId: string
      • field: string
      • value: null | string | number | boolean

      Returns void