Tabnine Logo
V8Object.getHandle
Code IndexAdd Tabnine to your IDE (free)

How to use
getHandle
method
in
com.eclipsesource.v8.V8Object

Best Java code snippets using com.eclipsesource.v8.V8Object.getHandle (Showing top 20 results out of 315)

origin: eclipsesource/J2V8

/**
 * Register a Java method reflectively given it's name a signature. The option to include
 * the JS Object in the callback can be specified by setting includeReceiver true.
 *
 * @param object The Java Object on which the method is defined.
 * @param methodName The name of the method to register.
 * @param jsFunctionName The name of the JavaScript function to register the
 * method with.
 * @param parameterTypes The parameter types of the method.
 * @param includeReceiver True if the first parameter should include the JS Object,
 * false otherwise.
 *
 * @return The receiver.
 */
public V8Object registerJavaMethod(final Object object, final String methodName, final String jsFunctionName, final Class<?>[] parameterTypes, final boolean includeReceiver) {
  v8.checkThread();
  checkReleased();
  try {
    Method method = object.getClass().getMethod(methodName, parameterTypes);
    method.setAccessible(true);
    v8.registerCallback(object, method, getHandle(), jsFunctionName, includeReceiver);
  } catch (NoSuchMethodException e) {
    throw new IllegalStateException(e);
  } catch (SecurityException e) {
    throw new IllegalStateException(e);
  }
  return this;
}
origin: eclipsesource/J2V8

/**
 * Register a Java method as a JavaScript function. When the JS Function is invoked
 * the Java method will be called.
 *
 * @param callback The JavaCallback to call when the JSFunction is invoked.
 * @param jsFunctionName The name of the JSFunction.
 *
 * @return The receiver.
 */
public V8Object registerJavaMethod(final JavaCallback callback, final String jsFunctionName) {
  v8.checkThread();
  checkReleased();
  v8.registerCallback(callback, getHandle(), jsFunctionName);
  return this;
}
origin: eclipsesource/J2V8

/**
 * Register a void Java method as a JavaScript function. When the JS Function is invoked
 * the Java method will be called.
 *
 * @param callback The JavaVoidCallback to call when the JSFunction is invoked.
 * @param jsFunctionName The name of the JSFunction.
 *
 * @return The receiver.
 */
public V8Object registerJavaMethod(final JavaVoidCallback callback, final String jsFunctionName) {
  v8.checkThread();
  checkReleased();
  v8.registerVoidCallback(callback, getHandle(), jsFunctionName);
  return this;
}
origin: eclipsesource/J2V8

/**
 * Sets the prototype of the receiver.
 *
 * @param value The prototype to associate with this V8Object.
 *
 * @return The receiver.
 */
public V8Object setPrototype(final V8Object value) {
  v8.checkThread();
  checkReleased();
  v8.setPrototype(v8.getV8RuntimePtr(), objectHandle, value.getHandle());
  return this;
}
origin: eclipsesource/J2V8

@Override
public String toString() {
  if (isReleased() || v8.isReleased()) {
    return "[Object released]";
  }
  v8.checkThread();
  return v8.toString(v8.getV8RuntimePtr(), getHandle());
}
origin: eclipsesource/J2V8

/**
 * Invoke a JavaScript function and return the result as a integer. If the
 * result is not an integer, or does not exist, then V8ResultUndefined is thrown.
 *
 * @param name The name of the JS Function to call.
 *
 * @param parameters The parameters to pass to the function. Parameters must be released.
 *
 * @return An integer representing the result of the function call or V8ResultUndefined
 * if the result is not an integer.
 */
public int executeIntegerFunction(final String name, final V8Array parameters) {
  v8.checkThread();
  checkReleased();
  v8.checkRuntime(parameters);
  long parametersHandle = parameters == null ? 0 : parameters.getHandle();
  return v8.executeIntegerFunction(v8.getV8RuntimePtr(), getHandle(), name, parametersHandle);
}
origin: eclipsesource/J2V8

/**
 * Invoke a JavaScript function and return the result as a double. If the
 * result is not a double, or does not exist, then V8ResultUndefined is thrown.
 *
 * @param name The name of the JS Function to call.
 *
 * @param parameters The parameters to pass to the function. Parameters must be released.
 *
 * @return A double representing the result of the function call or V8ResultUndefined
 * if the result is not a double.
 */
public double executeDoubleFunction(final String name, final V8Array parameters) {
  v8.checkThread();
  checkReleased();
  v8.checkRuntime(parameters);
  long parametersHandle = parameters == null ? 0 : parameters.getHandle();
  return v8.executeDoubleFunction(v8.getV8RuntimePtr(), getHandle(), name, parametersHandle);
}
origin: eclipsesource/J2V8

/**
 * Invoke a JavaScript function and return the result as a String. If the
 * result is not a String, or does not exist, then V8ResultUndefined is thrown.
 *
 * @param name The name of the JS Function to call.
 *
 * @param parameters The parameters to pass to the function. Parameters must be released.
 *
 * @return A String representing the result of the function call or V8ResultUndefined
 * if the result is not a String.
 */
public String executeStringFunction(final String name, final V8Array parameters) {
  v8.checkThread();
  checkReleased();
  v8.checkRuntime(parameters);
  long parametersHandle = parameters == null ? 0 : parameters.getHandle();
  return v8.executeStringFunction(v8.getV8RuntimePtr(), getHandle(), name, parametersHandle);
}
origin: eclipsesource/J2V8

/**
 * Invoke a JavaScript function and return the result as a boolean. If the
 * result is not a boolean, or does not exist, then V8ResultUndefined is thrown.
 *
 * @param name The name of the JS Function to call.
 *
 * @param parameters The parameters to pass to the function. Parameters must be released.
 *
 * @return A boolean representing the result of the function call or V8ResultUndefined
 * if the result is not a boolean.
 */
public boolean executeBooleanFunction(final String name, final V8Array parameters) {
  v8.checkThread();
  checkReleased();
  v8.checkRuntime(parameters);
  long parametersHandle = parameters == null ? 0 : parameters.getHandle();
  return v8.executeBooleanFunction(v8.getV8RuntimePtr(), getHandle(), name, parametersHandle);
}
origin: eclipsesource/J2V8

/**
 * Invoke the JavaScript function on the current runtime.
 *
 * @param receiver The object on which to call the function on. The
 * receiver will be mapped to 'this' in JavaScript. If receiver is null
 * or undefined, then the V8 runtime will be used instead.
 * @param parameters The parameters passed to the JS Function.
 *
 * @return The result of JavaScript function.
 */
@SuppressWarnings("resource")
public Object call(V8Object receiver, final V8Array parameters) {
  v8.checkThread();
  checkReleased();
  v8.checkRuntime(receiver);
  v8.checkRuntime(parameters);
  receiver = receiver != null ? receiver : v8;
  long parametersHandle = parameters == null ? 0 : parameters.getHandle();
  long receiverHandle = receiver.isUndefined() ? v8.getHandle() : receiver.getHandle();
  return v8.executeFunction(v8.getV8RuntimePtr(), receiverHandle, objectHandle, parametersHandle);
}
origin: eclipsesource/J2V8

/**
 * Register a Java method reflectively given it's name a signature. The option to include
 * the JS Object in the callback can be specified by setting includeReceiver true.
 *
 * @param object The Java Object on which the method is defined.
 * @param methodName The name of the method to register.
 * @param jsFunctionName The name of the JavaScript function to register the
 * method with.
 * @param parameterTypes The parameter types of the method.
 * @param includeReceiver True if the first parameter should include the JS Object,
 * false otherwise.
 *
 * @return The receiver.
 */
public V8Object registerJavaMethod(final Object object, final String methodName, final String jsFunctionName, final Class<?>[] parameterTypes, final boolean includeReceiver) {
  v8.checkThread();
  checkReleased();
  try {
    Method method = object.getClass().getMethod(methodName, parameterTypes);
    method.setAccessible(true);
    v8.registerCallback(object, method, getHandle(), jsFunctionName, includeReceiver);
  } catch (NoSuchMethodException e) {
    throw new IllegalStateException(e);
  } catch (SecurityException e) {
    throw new IllegalStateException(e);
  }
  return this;
}
origin: eclipsesource/J2V8

/**
 * Register a Java method as a JavaScript function. When the JS Function is invoked
 * the Java method will be called.
 *
 * @param callback The JavaCallback to call when the JSFunction is invoked.
 * @param jsFunctionName The name of the JSFunction.
 *
 * @return The receiver.
 */
public V8Object registerJavaMethod(final JavaCallback callback, final String jsFunctionName) {
  v8.checkThread();
  checkReleased();
  v8.registerCallback(callback, getHandle(), jsFunctionName);
  return this;
}
origin: eclipsesource/J2V8

/**
 * Register a void Java method as a JavaScript function. When the JS Function is invoked
 * the Java method will be called.
 *
 * @param callback The JavaVoidCallback to call when the JSFunction is invoked.
 * @param jsFunctionName The name of the JSFunction.
 *
 * @return The receiver.
 */
public V8Object registerJavaMethod(final JavaVoidCallback callback, final String jsFunctionName) {
  v8.checkThread();
  checkReleased();
  v8.registerVoidCallback(callback, getHandle(), jsFunctionName);
  return this;
}
origin: eclipsesource/J2V8

/**
 * Sets the prototype of the receiver.
 *
 * @param value The prototype to associate with this V8Object.
 *
 * @return The receiver.
 */
public V8Object setPrototype(final V8Object value) {
  v8.checkThread();
  checkReleased();
  v8.setPrototype(v8.getV8RuntimePtr(), objectHandle, value.getHandle());
  return this;
}
origin: eclipsesource/J2V8

@Override
public String toString() {
  if (isReleased() || v8.isReleased()) {
    return "[Object released]";
  }
  v8.checkThread();
  return v8.toString(v8.getV8RuntimePtr(), getHandle());
}
origin: eclipsesource/J2V8

/**
 * Invoke a JavaScript function and return the result as a double. If the
 * result is not a double, or does not exist, then V8ResultUndefined is thrown.
 *
 * @param name The name of the JS Function to call.
 *
 * @param parameters The parameters to pass to the function. Parameters must be released.
 *
 * @return A double representing the result of the function call or V8ResultUndefined
 * if the result is not a double.
 */
public double executeDoubleFunction(final String name, final V8Array parameters) {
  v8.checkThread();
  checkReleased();
  v8.checkRuntime(parameters);
  long parametersHandle = parameters == null ? 0 : parameters.getHandle();
  return v8.executeDoubleFunction(v8.getV8RuntimePtr(), getHandle(), name, parametersHandle);
}
origin: eclipsesource/J2V8

/**
 * Invoke a JavaScript function and return the result as a boolean. If the
 * result is not a boolean, or does not exist, then V8ResultUndefined is thrown.
 *
 * @param name The name of the JS Function to call.
 *
 * @param parameters The parameters to pass to the function. Parameters must be released.
 *
 * @return A boolean representing the result of the function call or V8ResultUndefined
 * if the result is not a boolean.
 */
public boolean executeBooleanFunction(final String name, final V8Array parameters) {
  v8.checkThread();
  checkReleased();
  v8.checkRuntime(parameters);
  long parametersHandle = parameters == null ? 0 : parameters.getHandle();
  return v8.executeBooleanFunction(v8.getV8RuntimePtr(), getHandle(), name, parametersHandle);
}
origin: eclipsesource/J2V8

/**
 * Invoke a JavaScript function and return the result as a integer. If the
 * result is not an integer, or does not exist, then V8ResultUndefined is thrown.
 *
 * @param name The name of the JS Function to call.
 *
 * @param parameters The parameters to pass to the function. Parameters must be released.
 *
 * @return An integer representing the result of the function call or V8ResultUndefined
 * if the result is not an integer.
 */
public int executeIntegerFunction(final String name, final V8Array parameters) {
  v8.checkThread();
  checkReleased();
  v8.checkRuntime(parameters);
  long parametersHandle = parameters == null ? 0 : parameters.getHandle();
  return v8.executeIntegerFunction(v8.getV8RuntimePtr(), getHandle(), name, parametersHandle);
}
origin: eclipsesource/J2V8

/**
 * Invoke a JavaScript function and return the result as a String. If the
 * result is not a String, or does not exist, then V8ResultUndefined is thrown.
 *
 * @param name The name of the JS Function to call.
 *
 * @param parameters The parameters to pass to the function. Parameters must be released.
 *
 * @return A String representing the result of the function call or V8ResultUndefined
 * if the result is not a String.
 */
public String executeStringFunction(final String name, final V8Array parameters) {
  v8.checkThread();
  checkReleased();
  v8.checkRuntime(parameters);
  long parametersHandle = parameters == null ? 0 : parameters.getHandle();
  return v8.executeStringFunction(v8.getV8RuntimePtr(), getHandle(), name, parametersHandle);
}
origin: eclipsesource/J2V8

/**
 * Invoke the JavaScript function on the current runtime.
 *
 * @param receiver The object on which to call the function on. The
 * receiver will be mapped to 'this' in JavaScript. If receiver is null
 * or undefined, then the V8 runtime will be used instead.
 * @param parameters The parameters passed to the JS Function.
 *
 * @return The result of JavaScript function.
 */
@SuppressWarnings("resource")
public Object call(V8Object receiver, final V8Array parameters) {
  v8.checkThread();
  checkReleased();
  v8.checkRuntime(receiver);
  v8.checkRuntime(parameters);
  receiver = receiver != null ? receiver : v8;
  long parametersHandle = parameters == null ? 0 : parameters.getHandle();
  long receiverHandle = receiver.isUndefined() ? v8.getHandle() : receiver.getHandle();
  return v8.executeFunction(v8.getV8RuntimePtr(), receiverHandle, objectHandle, parametersHandle);
}
com.eclipsesource.v8V8ObjectgetHandle

Popular methods of V8Object

  • registerJavaMethod
    Register a Java method reflectively given it's name a signature. The option to include the JS Object
  • <init>
  • get
    Returns the value associated with this key. Values are Java Objects. If the value is a primitive, it
  • executeObjectFunction
    Invoke a JavaScript function and return the result as a V8Object. If the result is not a V8Object th
  • executeStringFunction
    Invoke a JavaScript function and return the result as a String. If the result is not a String, or do
  • executeVoidFunction
    Invokes a JavaScript function which does not return a result.
  • getKeys
    Returns all the keys associated with this JavaScript Object. Keys associated with the objects protot
  • isUndefined
  • release
  • add
    Adds a key value pair to the receiver where the value is a boolean.
  • getArray
    Returns the V8Array value associated with this key. If the value associated with this key does not e
  • getString
    Returns the String value associated with this key. If the value associated with this key does not ex
  • getArray,
  • getString,
  • toString,
  • addUndefined,
  • equals,
  • executeArrayFunction,
  • executeBooleanFunction,
  • executeFunction,
  • executeIntegerFunction,
  • getInteger

Popular in Java

  • Making http post requests using okhttp
  • getApplicationContext (Context)
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (Timer)
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Join (org.hibernate.mapping)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now