com.eclipsesource.v8.V8Array.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中com.eclipsesource.v8.V8Array.<init>()方法的一些代码示例,展示了V8Array.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。V8Array.<init>()方法的具体详情如下:
包路径:com.eclipsesource.v8.V8Array
类名称:V8Array
方法名:<init>

V8Array.<init>介绍

[英]Creates a new V8Array and associates it with the given runtime. V8Arrays have native resources and as such, must be released.
[中]创建一个新的V8Array并将其与给定的运行时关联。V8Array具有本机资源,因此必须释放。

代码示例

代码示例来源:origin: eclipsesource/J2V8

@Override
protected V8Value createTwin() {
  return new V8Array(v8);
}

代码示例来源:origin: jooby-project/jooby

public V8Array array() {
 return register(v8, new V8Array(v8));
}

代码示例来源:origin: eclipsesource/J2V8

@Override
  public Object invoke(final V8Object receiver, final V8Array parameters) {
    V8Array requireParams = new V8Array(v8);
    try {
      requireParams.push(file.getAbsolutePath());
      return require.call(null, requireParams);
    } finally {
      requireParams.close();
    }
  }
});

代码示例来源:origin: eclipsesource/J2V8

private static V8Array toV8Array(final V8 v8, final List<? extends Object> list, final Map<Object, V8Value> cache) {
  if (cache.containsKey(new ListWrapper(list))) {
    return (V8Array) cache.get(new ListWrapper(list));
  }
  V8Array result = new V8Array(v8);
  cache.put(new ListWrapper(list), result);
  try {
    for (int i = 0; i < list.size(); i++) {
      Object value = list.get(i);
      pushValue(v8, result, value, cache);
    }
  } catch (IllegalStateException e) {
    result.close();
    throw e;
  }
  return result;
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Enables a breakpoint.
 *
 * @param breakpointID The breakpoint to enable.
 */
public void enableScriptBreakPoint(final int breakpointID) {
  V8Array parameters = new V8Array(runtime);
  parameters.push(breakpointID);
  try {
    debugObject.executeVoidFunction(ENABLE_SCRIPT_BREAK_POINT, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Disables a breakpoint.
 *
 * @param breakpointID The breakpoint to disable
 */
public void disableScriptBreakPoint(final int breakpointID) {
  V8Array parameters = new V8Array(runtime);
  parameters.push(breakpointID);
  try {
    debugObject.executeVoidFunction(DISABLE_SCRIPT_BREAK_POINT, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Removes a Breakpoint.
 *
 * @param breakpointID The ID of the breakpoint to remove.
 */
public void clearBreakPoint(final int breakpointID) {
  V8Array parameters = new V8Array(runtime);
  parameters.push(breakpointID);
  try {
    debugObject.executeVoidFunction(CLEAR_BREAK_POINT, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Registers a function breakpoint. When the JavaScript function
 * is invoked, the breakpoint will be 'hit'.
 *
 * @param function The function on which to register the breakpoint.
 * @return The berakpointID.
 */
public int setBreakpoint(final V8Function function) {
  V8Array parameters = new V8Array(runtime);
  parameters.push(function);
  try {
    return debugObject.executeIntegerFunction(SET_BREAK_POINT, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Invokes NodeJS require() on the specified file. This will load the module, execute
 * it and return the exports object to the caller. The exports object must be released.
 *
 * @param file The module to load.
 * @return The exports object.
 */
public V8Object require(final File file) {
  v8.checkThread();
  V8Array requireParams = new V8Array(v8);
  try {
    requireParams.push(file.getAbsolutePath());
    return (V8Object) require.call(null, requireParams);
  } finally {
    requireParams.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Returns the name of the argument at the given index.
 *
 * @param index The index of the argument name to return.
 * @return The name of argument at the given index.
 */
public String getArgumentName(final int index) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(index);
  try {
    return v8Object.executeStringFunction(ARGUMENT_NAME, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Returns the name of the local variable at the given index.
 *
 * @param index The index of the local variable name to return.
 * @return The name of local variable at the given index.
 */
public String getLocalName(final int index) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(index);
  try {
    return v8Object.executeStringFunction(LOCAL_NAME, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Sets a condition to be evaluated before determining if
 * the breakpoint event should be fired.
 *
 * @param condition A JavaScript condition to be evaluated.
 */
public void setCondition(final String condition) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(condition);
  try {
    v8Object.executeVoidFunction(SET_CONDITION, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Indicates to the debugger how to proceed. If not called,
 * the debugger will continue running until the next breakpoint
 * is hit.
 *
 * @param action The step action to use.
 */
public void prepareStep(final StepAction action) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(action.index);
  try {
    v8Object.executeVoidFunction(PREPARE_STEP, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Changes the current condition on the breakpoint as specified by the breakpoint ID
 *
 * @param breakpointID The ID of the breakpoint of which to change the condition on
 * @param condition The new condition to set
 */
public void changeBreakPointCondition(final int breakpointID, final String condition) {
  V8Array parameters = new V8Array(runtime);
  parameters.push(breakpointID);
  parameters.push(condition);
  try {
    debugObject.executeVoidFunction(CHANGE_BREAK_POINT_CONDITION, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Sets the value of a variable in this scope.
 *
 * @param name The name of the variable
 * @param value The value
 */
public void setVariableValue(final String name, final boolean value) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(name);
  parameters.push(value);
  try {
    v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Sets the value of a variable in this scope.
 *
 * @param name The name of the variable
 * @param value The value
 */
public void setVariableValue(final String name, final double value) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(name);
  parameters.push(value);
  try {
    v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Sets the value of a variable in this scope.
 *
 * @param name The name of the variable
 * @param value The value
 */
public void setVariableValue(final String name, final V8Value value) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(name);
  parameters.push(value);
  try {
    v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Sets the value of a variable in this scope.
 *
 * @param name The name of the variable
 * @param value The value
 */
public void setVariableValue(final String name, final int value) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(name);
  parameters.push(value);
  try {
    v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Sets the value of a variable in this scope.
 *
 * @param name The name of the variable
 * @param value The value
 */
public void setVariableValue(final String name, final String value) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(name);
  parameters.push(value);
  try {
    v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

private void setupBreakpointHandler() {
  BreakpointHandler handler = new BreakpointHandler();
  debugObject.registerJavaMethod(handler, DEBUG_BREAK_HANDLER);
  V8Function debugHandler = null;
  V8Array parameters = null;
  try {
    debugHandler = (V8Function) debugObject.getObject(DEBUG_BREAK_HANDLER);
    parameters = new V8Array(runtime);
    parameters.push(debugHandler);
    debugObject.executeFunction(SET_LISTENER, parameters);
  } finally {
    if ((debugHandler != null) && !debugHandler.isReleased()) {
      debugHandler.close();
    }
    if ((parameters != null) && !parameters.isReleased()) {
      parameters.close();
    }
  }
}

相关文章