rhino
CloudControl Pro 9 Docs / rhino
rhino
The rhino module provides rhino engine-compatible Java interaction APIs, such as importing Java packages, classes.But this module does not provide JavaAdapter, please use $java.defineClass
to achieve similar functions.
Table of contents
Variables
Functions
Variables
Packages
• Const
Packages: JavaPackages
= rhino.packages
Variable to access Java package or class. For example, Packages.java
or Packages.kotlin
.
Example
"nodejs";
const { Packages } = require("rhino");
const OkHttpClient = Packages.okhttp3.OkHttpClient;
const client = new OkHttpClient.Builder().build();
console.log(client);
Functions
install
▸ install(scope?
): void
Install compatibility variables and functions for Rhino engine Java interaction, currently supports:
Packages
variable, to access Java package or classjava
,javax
,org
,com
,edu
,net
,android
packages, to access common Java packages and classesJavaAdapter
class, to implement Java class or interface dynamically in JavaScript. Currently not supported, will be supported in a future version
Not supported importClass
and importPackage
functions, please use assignment statement instead.
Example
"nodejs";
require("rhino").install();
const View = android.view.View;
const StringBuilder = java.lang.StringBuilder;
console.log(View.class.getName());
console.log(new StringBuilder().append("Hello").toString());
Parameters
Name | Type | Default value |
---|---|---|
scope |
any |
global |
Returns
void