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

x33g5p2x  于2022-02-03 转载在 JavaScript  
字(5.3k)|赞(0)|评价(0)|浏览(218)

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

Wrapper.unwrap介绍

[英]Unwrap the object by returning the wrapped value.
[中]通过返回包裹的值来展开对象。

代码示例

代码示例来源:origin: org.freemarker/freemarker

@Override
public TemplateModel wrap(Object obj) throws TemplateModelException {
  // So our existence builtins work as expected.
  if (obj == UNDEFINED_INSTANCE || obj == UniqueTag.NOT_FOUND) {
    return null;
  }
  // UniqueTag.NULL_VALUE represents intentionally set null in Rhino, and
  // BeansWrapper#nullModel also represents intentionally returned null.
  // I [A.Sz.] am fairly certain that this value is never passed out of
  // any of the Rhino code back to clients, but is instead always being
  // converted back to null. However, since this object is available to 
  // any 3rd party Scriptable implementations as well, they might return
  // it, so we'll just be on the safe side, and handle it.
  if (obj == UniqueTag.NULL_VALUE) {
    return super.wrap(null);
  }
  // So, say, a JavaAdapter for FreeMarker interfaces works
  if (obj instanceof Wrapper) {
    obj = ((Wrapper) obj).unwrap();
  }
  return super.wrap(obj);
}

代码示例来源:origin: org.apache.cocoon/cocoon-flowscript-impl

/**
 * Unwrap a Rhino object (getting the raw java object) and convert undefined to null
 */
public static Object unwrap(Object obj) {
  if (obj instanceof Wrapper) {
    obj = ((Wrapper)obj).unwrap();
  } else if (obj == Undefined.instance) {
    obj = null;
  }
  return obj;
}

代码示例来源:origin: org.bsc/jvm-npm-rhino

protected Object unwrapReturnValue(Object result) {
  if (result instanceof Wrapper) {
    result = ((Wrapper) result).unwrap();
  }
  return result instanceof Undefined ? null : result;
}

代码示例来源:origin: viltgroup/minium

protected Object unwrappedValue(Object val) {
  if (val != null && val instanceof Wrapper) {
    val = ((Wrapper) val).unwrap();
  }
  return val;
}

代码示例来源:origin: org.apache.cocoon/cocoon-flowscript-impl

private static Object unwrap(Object obj) {
  if (obj instanceof Wrapper) {
    obj = ((Wrapper)obj).unwrap();
  } else if (obj == Undefined.instance) {
    obj = null;
  }
  return obj;
}

代码示例来源:origin: org.apache.cocoon/cocoon-flowscript-impl

private static Object unwrap(Object obj) {
  if (obj instanceof Wrapper) {
    obj = ((Wrapper)obj).unwrap();
  } else if (obj == Undefined.instance) {
    obj = null;
  }
  return obj;
}

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

private static OutputStream toOutputStream(Object value) {
  OutputStream os = null;
  if (value instanceof Wrapper) {
    Object unwrapped = ((Wrapper)value).unwrap();
    if (unwrapped instanceof OutputStream) {
      os = (OutputStream)unwrapped;
    }
  }
  return os;
}

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

@Override
public boolean hasInstance(Scriptable value) {
  if (!(value instanceof Wrapper))
    return false;
  Object instance = ((Wrapper)value).unwrap();
  return cls.isInstance(instance);
}

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

@Override
public boolean hasInstance(Scriptable value) {
  if (!(value instanceof Wrapper))
    return false;
  Object instance = ((Wrapper)value).unwrap();
  return cls.isInstance(instance);
}

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

ResolvedOverload(Object[] args, int index) {
  this.index = index;
  types = new Class<?>[args.length];
  for (int i = 0, l = args.length; i < l; i++) {
    Object arg = args[i];
    if (arg instanceof Wrapper)
      arg = ((Wrapper)arg).unwrap();
    types[i] = arg == null ? null : arg.getClass();
  }
}

代码示例来源:origin: org.springframework.extensions.surf/spring-webscripts

public boolean hasInstance(Scriptable value)
{
  if (!(value instanceof Wrapper))
    return false;
  Object instance = ((Wrapper)value).unwrap();
  return Map.class.isInstance(instance);
}

代码示例来源:origin: org.alfresco/alfresco-repository

public boolean hasInstance(Scriptable value)
{
  if (!(value instanceof Wrapper))
    return false;
  Object instance = ((Wrapper)value).unwrap();
  return Map.class.isInstance(instance);
}

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

@Override
public boolean hasInstance(Scriptable value) {
  if (!(value instanceof Wrapper))
    return false;
  Object instance = ((Wrapper)value).unwrap();
  return cls.isInstance(instance);
}

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

ResolvedOverload(Object[] args, int index) {
  this.index = index;
  types = new Class<?>[args.length];
  for (int i = 0, l = args.length; i < l; i++) {
    Object arg = args[i];
    if (arg instanceof Wrapper)
      arg = ((Wrapper)arg).unwrap();
    types[i] = arg == null ? null : arg.getClass();
  }
}

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

public boolean hasInstance(Scriptable value) {
  if (!(value instanceof Wrapper))
    return false;
  Object instance = ((Wrapper)value).unwrap();
  return cls.isInstance(instance);
}

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

@Override
public boolean hasInstance(Scriptable value) {
  if (!(value instanceof Wrapper))
    return false;
  Object instance = ((Wrapper)value).unwrap();
  return cls.isInstance(instance);
}

代码示例来源:origin: org.springframework.extensions.surf/spring-webscripts

public boolean hasInstance(Scriptable value)
{
  if (!(value instanceof Wrapper))
    return false;
  Object instance = ((Wrapper)value).unwrap();
  return Map.class.isInstance(instance);
}

代码示例来源:origin: org.alfresco.surf/spring-webscripts

public boolean hasInstance(Scriptable value)
{
  if (!(value instanceof Wrapper))
    return false;
  Object instance = ((Wrapper)value).unwrap();
  return Map.class.isInstance(instance);
}

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

ResolvedOverload(Object[] args, int index) {
  this.index = index;
  types = new Class<?>[args.length];
  for (int i = 0, l = args.length; i < l; i++) {
    Object arg = args[i];
    if (arg instanceof Wrapper)
      arg = ((Wrapper)arg).unwrap();
    types[i] = arg == null ? null : arg.getClass();
  }
}

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

/**
   * @see org.mozilla.javascript.Function#call
   */
  @Override
  public Object call(Context cx, Scriptable scope, Scriptable thisObj,
            Object[] args)
  {
    synchronized(thisObj instanceof Wrapper ? ((Wrapper)thisObj).unwrap() : thisObj) {
      return ((Function)obj).call(cx,scope,thisObj,args);
    }
  }
}

相关文章