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

x33g5p2x  于2022-01-18 转载在 JavaScript  
字(6.8k)|赞(0)|评价(0)|浏览(164)

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

Context.getWrapFactory介绍

[英]Return the current WrapFactory, or null if none is defined.
[中]返回当前WrapFactory,如果未定义,则返回null。

代码示例

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

@Override
public Object get(int index, Scriptable start) {
  if (0 <= index && index < length) {
    Context cx = Context.getContext();
    Object obj = Array.get(array, index);
    return cx.getWrapFactory().wrap(cx, this, obj, cls);
  }
  return Undefined.instance;
}

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

/**
 * @deprecated Use {@link Context#getWrapFactory()} together with calling {@link
 * WrapFactory#wrap(Context, Scriptable, Object, Class)}
 */
@Deprecated
public static Object wrap(Scriptable scope, Object obj, Class<?> staticType) {
  Context cx = Context.getContext();
  return cx.getWrapFactory().wrap(cx, scope, obj, staticType);
}

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

public Object get(int index, Scriptable start) {
  if (0 <= index && index < length) {
    Context cx = Context.getContext();
    Object obj = Array.get(array, index);
    return cx.getWrapFactory().wrap(cx, this, obj, cls);
  }
  return Undefined.instance;
}

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

@Override
public Object get(int index, Scriptable start) {
  if (0 <= index && index < length) {
    Context cx = Context.getContext();
    Object obj = Array.get(array, index);
    return cx.getWrapFactory().wrap(cx, this, obj, cls);
  }
  return Undefined.instance;
}

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

@Override
public Object get(int index, Scriptable start) {
  if (0 <= index && index < length) {
    Context cx = Context.getContext();
    Object obj = Array.get(array, index);
    return cx.getWrapFactory().wrap(cx, this, obj, cls);
  }
  return Undefined.instance;
}

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

@Override
public Object get(int index, Scriptable start) {
  if (0 <= index && index < length) {
    Context cx = Context.getContext();
    Object obj = Array.get(array, index);
    return cx.getWrapFactory().wrap(cx, this, obj, cls);
  }
  return Undefined.instance;
}

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

@Override
public Object get(int index, Scriptable start) {
  if (0 <= index && index < length) {
    Context cx = Context.getContext();
    Object obj = Array.get(array, index);
    return cx.getWrapFactory().wrap(cx, this, obj, cls);
  }
  return Undefined.instance;
}

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

/**
@deprecated Use {@link Context#getWrapFactory()} together with calling {@link
WrapFactory#wrap(Context, Scriptable, Object, Class)}
*/
  public static Object wrap(Scriptable scope, Object obj, Class<?> staticType) {

    Context cx = Context.getContext();
    return cx.getWrapFactory().wrap(cx, scope, obj, staticType);
  }

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

/**
@deprecated Use {@link Context#getWrapFactory()} together with calling {@link
WrapFactory#wrap(Context, Scriptable, Object, Class)}
*/
  public static Object wrap(Scriptable scope, Object obj, Class<?> staticType) {

    Context cx = Context.getContext();
    return cx.getWrapFactory().wrap(cx, scope, obj, staticType);
  }

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

/**
@deprecated Use {@link Context#getWrapFactory()} together with calling {@link
WrapFactory#wrap(Context, Scriptable, Object, Class)}
*/
  public static Object wrap(Scriptable scope, Object obj, Class<?> staticType) {

    Context cx = Context.getContext();
    return cx.getWrapFactory().wrap(cx, scope, obj, staticType);
  }

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

/**
@deprecated Use {@link Context#getWrapFactory()} together with calling {@link
WrapFactory#wrap(Context cx, Scriptable scope, Object obj, Class)}
*/
  public static Object wrap(Scriptable scope, Object obj, Class staticType) {

    Context cx = Context.getContext();
    return cx.getWrapFactory().wrap(cx, scope, obj, staticType);
  }

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

/**
@deprecated Use {@link Context#getWrapFactory()} together with calling {@link
WrapFactory#wrap(Context, Scriptable, Object, Class)}
*/
  public static Object wrap(Scriptable scope, Object obj, Class<?> staticType) {

    Context cx = Context.getContext();
    return cx.getWrapFactory().wrap(cx, scope, obj, staticType);
  }

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

private static Object doCall(Context cx, Scriptable scope,
               Scriptable thisObj, Function f,
               Object[] args, long argsToWrap)
{
  // Wrap the rest of objects
  for (int i = 0; i != args.length; ++i) {
    if (0 != (argsToWrap & (1 << i))) {
      Object arg = args[i];
      if (!(arg instanceof Scriptable)) {
        args[i] = cx.getWrapFactory().wrap(cx, scope, arg,
                          null);
      }
    }
  }
  return f.call(cx, scope, thisObj, args);
}

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

private static Object doCall(Context cx, Scriptable scope,
               Scriptable thisObj, Function f,
               Object[] args, long argsToWrap)
{
  // Wrap the rest of objects
  for (int i = 0; i != args.length; ++i) {
    if (0 != (argsToWrap & (1 << i))) {
      Object arg = args[i];
      if (!(arg instanceof Scriptable)) {
        args[i] = cx.getWrapFactory().wrap(cx, scope, arg,
                          null);
      }
    }
  }
  return f.call(cx, scope, thisObj, args);
}

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

private static Object doCall(Context cx, Scriptable scope,
               Scriptable thisObj, Function f,
               Object[] args, long argsToWrap)
{
  // Wrap the rest of objects
  for (int i = 0; i != args.length; ++i) {
    if (0 != (argsToWrap & (1 << i))) {
      Object arg = args[i];
      if (!(arg instanceof Scriptable)) {
        args[i] = cx.getWrapFactory().wrap(cx, scope, arg,
                          null);
      }
    }
  }
  return f.call(cx, scope, thisObj, args);
}

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

static Scriptable constructSpecific(Context cx, Scriptable scope,
                  Object[] args, MemberBox ctor)
{
  Object instance = constructInternal(args, ctor);
  // we need to force this to be wrapped, because construct _has_
  // to return a scriptable
  Scriptable topLevel = ScriptableObject.getTopLevelScope(scope);
  return cx.getWrapFactory().wrapNewObject(cx, topLevel, instance);
}

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

static Scriptable constructSpecific(Context cx, Scriptable scope,
                  Object[] args, MemberBox ctor)
{
  Object instance = constructInternal(args, ctor);
  // we need to force this to be wrapped, because construct _has_
  // to return a scriptable
  Scriptable topLevel = ScriptableObject.getTopLevelScope(scope);
  return cx.getWrapFactory().wrapNewObject(cx, topLevel, instance);
}

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

static Scriptable constructSpecific(Context cx, Scriptable scope,
                  Object[] args, MemberBox ctor)
{
  Object instance = constructInternal(args, ctor);
  // we need to force this to be wrapped, because construct _has_
  // to return a scriptable
  Scriptable topLevel = ScriptableObject.getTopLevelScope(scope);
  return cx.getWrapFactory().wrapNewObject(cx, topLevel, instance);
}

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

static Scriptable constructSpecific(Context cx, Scriptable scope,
                  Object[] args, MemberBox ctor)
{
  Object instance = constructInternal(args, ctor);
  // we need to force this to be wrapped, because construct _has_
  // to return a scriptable
  Scriptable topLevel = ScriptableObject.getTopLevelScope(scope);
  return cx.getWrapFactory().wrapNewObject(cx, topLevel, instance);
}

代码示例来源:origin: org.seasar.mayaa/mayaa

public Object create(Object[] params) {
    ServiceCycle cycle = CycleUtil.getServiceCycle();
    Scriptable parent;
    Context cx = RhinoUtil.enter();
    try {
      Scriptable standard = getStandardObjects();
      parent = cx.getWrapFactory().wrapAsJavaObject(
          cx, standard, cycle, ServiceCycle.class);
    } finally {
      Context.exit();
    }
    return parent;
  }
});

相关文章

微信公众号

Context类方法