org.mozilla.javascript.Function.construct()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 JavaScript  
字(6.1k)|赞(0)|评价(0)|浏览(181)

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

Function.construct介绍

[英]Call the function as a constructor. This method is invoked by the runtime in order to satisfy a use of the JavaScript new operator. This method is expected to create a new object and return it.
[中]将函数作为构造函数调用。运行时调用此方法是为了满足JavaScriptnew操作符的使用。此方法将创建一个新对象并返回它。

代码示例

代码示例来源:origin: org.apache.xmlgraphics/batik-bridge

public Scriptable construct(Context cx,
              Scriptable scope, Object[] args) {
  return this.delegate.construct(cx, scope, args);
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

public Scriptable construct(Context cx,
              Scriptable scope, Object[] args) {
  return this.delegate.construct(cx, scope, args);
}

代码示例来源:origin: apache/batik

public Scriptable construct(Context cx,
              Scriptable scope, Object[] args) {
  return this.delegate.construct(cx, scope, args);
}

代码示例来源:origin: rhino/js

/**
 * Operator new.
 *
 * See ECMA 11.2.2
 */
public static Scriptable newObject(Object fun, Context cx,
                  Scriptable scope, Object[] args)
{
  if (!(fun instanceof Function)) {
    throw notFunctionError(fun);
  }
  Function function = (Function)fun;
  return function.construct(cx, scope, args);
}

代码示例来源:origin: ro.isdc.wro4j/rhino

/**
 * Operator new.
 *
 * See ECMA 11.2.2
 */
public static Scriptable newObject(Object fun, Context cx,
                  Scriptable scope, Object[] args)
{
  if (!(fun instanceof Function)) {
    throw notFunctionError(fun);
  }
  Function function = (Function)fun;
  return function.construct(cx, scope, args);
}

代码示例来源:origin: rhino/js

public static Scriptable newObject(Context cx, Scriptable scope,
                  String constructorName, Object[] args)
{
  scope = ScriptableObject.getTopLevelScope(scope);
  Function ctor = getExistingCtor(cx, scope, constructorName);
  if (args == null) { args = ScriptRuntime.emptyArgs; }
  return ctor.construct(cx, scope, args);
}

代码示例来源:origin: geogebra/geogebra

static Scriptable newNativeError(Context cx, Scriptable scope,
                 TopLevel.NativeErrors type, Object[] args)
{
  scope = ScriptableObject.getTopLevelScope(scope);
  Function ctor = TopLevel.getNativeErrorCtor(cx, scope, type);
  if (args == null) { args = ScriptRuntime.emptyArgs; }
  return ctor.construct(cx, scope, args);
}

代码示例来源:origin: io.apigee/rhino

public static Scriptable newObject(Context cx, Scriptable scope,
                  String constructorName, Object[] args)
{
  scope = ScriptableObject.getTopLevelScope(scope);
  Function ctor = getExistingCtor(cx, scope, constructorName);
  if (args == null) { args = ScriptRuntime.emptyArgs; }
  return ctor.construct(cx, scope, args);
}

代码示例来源:origin: com.github.tntim96/rhino

public static Scriptable newBuiltinObject(Context cx, Scriptable scope,
                     TopLevel.Builtins type,
                     Object[] args)
{
  scope = ScriptableObject.getTopLevelScope(scope);
  Function ctor = TopLevel.getBuiltinCtor(cx, scope, type);
  if (args == null) { args = ScriptRuntime.emptyArgs; }
  return ctor.construct(cx, scope, args);
}

代码示例来源:origin: geogebra/geogebra

public static Scriptable newObject(Context cx, Scriptable scope,
                  String constructorName, Object[] args)
{
  scope = ScriptableObject.getTopLevelScope(scope);
  Function ctor = getExistingCtor(cx, scope, constructorName);
  if (args == null) { args = ScriptRuntime.emptyArgs; }
  return ctor.construct(cx, scope, args);
}

代码示例来源:origin: geogebra/geogebra

public static Scriptable newBuiltinObject(Context cx, Scriptable scope,
                     TopLevel.Builtins type,
                     Object[] args)
{
  scope = ScriptableObject.getTopLevelScope(scope);
  Function ctor = TopLevel.getBuiltinCtor(cx, scope, type);
  if (args == null) { args = ScriptRuntime.emptyArgs; }
  return ctor.construct(cx, scope, args);
}

代码示例来源:origin: geogebra/geogebra

@Override
public Scriptable construct(Context cx, Scriptable scope, Object[] extraArgs) {
 if (targetFunction instanceof Function) {
  return ((Function) targetFunction).construct(cx, scope, concat(boundArgs, extraArgs));
 }
 throw ScriptRuntime.typeError0("msg.not.ctor");
}

代码示例来源:origin: com.github.tntim96/rhino

public static Scriptable newObject(Context cx, Scriptable scope,
                  String constructorName, Object[] args)
{
  scope = ScriptableObject.getTopLevelScope(scope);
  Function ctor = getExistingCtor(cx, scope, constructorName);
  if (args == null) { args = ScriptRuntime.emptyArgs; }
  return ctor.construct(cx, scope, args);
}

代码示例来源:origin: io.apigee/rhino

@Override
public Scriptable construct(Context cx, Scriptable scope, Object[] extraArgs) {
 if (targetFunction instanceof Function) {
  return ((Function) targetFunction).construct(cx, scope, concat(boundArgs, extraArgs));
 }
 throw ScriptRuntime.typeError0("msg.not.ctor");
}

代码示例来源:origin: io.apigee/rhino

public static Scriptable newBuiltinObject(Context cx, Scriptable scope,
                     TopLevel.Builtins type,
                     Object[] args)
{
  scope = ScriptableObject.getTopLevelScope(scope);
  Function ctor = TopLevel.getBuiltinCtor(cx, scope, type);
  if (args == null) { args = ScriptRuntime.emptyArgs; }
  return ctor.construct(cx, scope, args);
}

代码示例来源:origin: ro.isdc.wro4j/rhino

public static Scriptable newBuiltinObject(Context cx, Scriptable scope,
                     TopLevel.Builtins type,
                     Object[] args)
{
  scope = ScriptableObject.getTopLevelScope(scope);
  Function ctor = TopLevel.getBuiltinCtor(cx, scope, type);
  if (args == null) { args = ScriptRuntime.emptyArgs; }
  return ctor.construct(cx, scope, args);
}

代码示例来源:origin: com.sun.phobos/phobos-rhino

public static Scriptable newObject(Context cx, Scriptable scope,
                  String constructorName, Object[] args)
{
  scope = ScriptableObject.getTopLevelScope(scope);
  Function ctor = getExistingCtor(cx, scope, constructorName);
  if (args == null) { args = ScriptRuntime.emptyArgs; }
  return ctor.construct(cx, scope, args);
}

代码示例来源:origin: ro.isdc.wro4j/rhino

@Override
public Scriptable construct(Context cx, Scriptable scope, Object[] extraArgs) {
 if (targetFunction instanceof Function) {
  return ((Function) targetFunction).construct(cx, scope, concat(boundArgs, extraArgs));
 }
 throw ScriptRuntime.typeError0("msg.not.ctor");
}

代码示例来源:origin: ro.isdc.wro4j/rhino

public static Scriptable newObject(Context cx, Scriptable scope,
                  String constructorName, Object[] args)
{
  scope = ScriptableObject.getTopLevelScope(scope);
  Function ctor = getExistingCtor(cx, scope, constructorName);
  if (args == null) { args = ScriptRuntime.emptyArgs; }
  return ctor.construct(cx, scope, args);
}

代码示例来源:origin: com.github.tntim96/rhino

@Override
public Scriptable construct(Context cx, Scriptable scope, Object[] extraArgs) {
 if (targetFunction instanceof Function) {
  return ((Function) targetFunction).construct(cx, scope, concat(boundArgs, extraArgs));
 }
 throw ScriptRuntime.typeError0("msg.not.ctor");
}

相关文章