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

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

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

Context.isSealed介绍

[英]Checks if this is a sealed Context. A sealed Context instance does not allow to modify any of its properties and will throw an exception on any such attempt.
[中]检查这是否为密封上下文。密封上下文实例不允许修改其任何属性,并将在任何此类尝试中引发异常。

代码示例

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

/**
 * @see #isJavaPrimitiveWrap()
 */
public final void setJavaPrimitiveWrap(boolean value)
{
  Context cx = Context.getCurrentContext();
  if (cx != null && cx.isSealed()) {
    Context.onSealedMutation();
  }
  javaPrimitiveWrap = value;
}

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

/**
 * @see #isJavaPrimitiveWrap()
 */
public final void setJavaPrimitiveWrap(boolean value)
{
  Context cx = Context.getCurrentContext();
  if (cx != null && cx.isSealed()) {
    Context.onSealedMutation();
  }
  javaPrimitiveWrap = value;
}

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

/**
 * @see #isJavaPrimitiveWrap()
 */
public final void setJavaPrimitiveWrap(boolean value)
{
  Context cx = Context.getCurrentContext();
  if (cx != null && cx.isSealed()) {
    Context.onSealedMutation();
  }
  javaPrimitiveWrap = value;
}

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

/**
 * @see #isJavaPrimitiveWrap()
 */
public final void setJavaPrimitiveWrap(boolean value)
{
  Context cx = Context.getCurrentContext();
  if (cx != null && cx.isSealed()) {
    Context.onSealedMutation();
  }
  javaPrimitiveWrap = value;
}

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

/**
 * @see #isJavaPrimitiveWrap()
 */
public final void setJavaPrimitiveWrap(boolean value)
{
  Context cx = Context.getCurrentContext();
  if (cx != null && cx.isSealed()) {
    Context.onSealedMutation();
  }
  javaPrimitiveWrap = value;
}

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

/**
 * @see #isJavaPrimitiveWrap()
 */
public final void setJavaPrimitiveWrap(boolean value)
{
  Context cx = Context.getCurrentContext();
  if (cx != null && cx.isSealed()) {
    Context.onSealedMutation();
  }
  javaPrimitiveWrap = value;
}

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

private static Context prepareNewContext(ContextFactory factory,
                     Object contextHelper)
{
  Context cx = factory.makeContext();
  if (cx.factory != null || cx.enterCount != 0) {
    throw new IllegalStateException("factory.makeContext() returned Context instance already associated with some thread");
  }
  cx.factory = factory;
  factory.onContextCreated(cx);
  if (factory.isSealed() && !cx.isSealed()) {
    cx.seal(null);
  }
  VMBridge.instance.setContext(contextHelper, cx);
  return cx;
}

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

static final Context enter(Context cx, ContextFactory factory)
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context old = VMBridge.instance.getContext(helper);
  if (old != null) {
    cx = old;
  } else {
    if (cx == null) {
      cx = factory.makeContext();
      if (cx.enterCount != 0) {
        throw new IllegalStateException("factory.makeContext() returned Context instance already associated with some thread");
      }
      factory.onContextCreated(cx);
      if (factory.isSealed() && !cx.isSealed()) {
        cx.seal(null);
      }
    } else {
      if (cx.enterCount != 0) {
        throw new IllegalStateException("can not use Context instance already associated with some thread");
      }
    }
    VMBridge.instance.setContext(helper, cx);
  }
  ++cx.enterCount;
  return cx;
 }

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

static final Context enter(Context cx, ContextFactory factory)
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context old = VMBridge.instance.getContext(helper);
  if (old != null) {
    cx = old;
  } else {
    if (cx == null) {
      cx = factory.makeContext();
      if (cx.enterCount != 0) {
        throw new IllegalStateException("factory.makeContext() returned Context instance already associated with some thread");
      }
      factory.onContextCreated(cx);
      if (factory.isSealed() && !cx.isSealed()) {
        cx.seal(null);
      }
    } else {
      if (cx.enterCount != 0) {
        throw new IllegalStateException("can not use Context instance already associated with some thread");
      }
    }
    VMBridge.instance.setContext(helper, cx);
  }
  ++cx.enterCount;
  return cx;
 }

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

static final Context enter(Context cx, ContextFactory factory)
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context old = VMBridge.instance.getContext(helper);
  if (old != null) {
    cx = old;
  } else {
    if (cx == null) {
      cx = factory.makeContext();
      if (cx.enterCount != 0) {
        throw new IllegalStateException("factory.makeContext() returned Context instance already associated with some thread");
      }
      factory.onContextCreated(cx);
      if (factory.isSealed() && !cx.isSealed()) {
        cx.seal(null);
      }
    } else {
      if (cx.enterCount != 0) {
        throw new IllegalStateException("can not use Context instance already associated with some thread");
      }
    }
    VMBridge.instance.setContext(helper, cx);
  }
  ++cx.enterCount;
  return cx;
 }

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

static final Context enter(Context cx, ContextFactory factory)
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context old = VMBridge.instance.getContext(helper);
  if (old != null) {
    cx = old;
  } else {
    if (cx == null) {
      cx = factory.makeContext();
      if (cx.enterCount != 0) {
        throw new IllegalStateException("factory.makeContext() returned Context instance already associated with some thread");
      }
      factory.onContextCreated(cx);
      if (factory.isSealed() && !cx.isSealed()) {
        cx.seal(null);
      }
    } else {
      if (cx.enterCount != 0) {
        throw new IllegalStateException("can not use Context instance already associated with some thread");
      }
    }
    VMBridge.instance.setContext(helper, cx);
  }
  ++cx.enterCount;
  return cx;
 }

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

static final Context enter(Context cx, ContextFactory factory)
{
  Object helper = VMBridge.instance.getThreadContextHelper();
  Context old = VMBridge.instance.getContext(helper);
  if (old != null) {
    cx = old;
  } else {
    if (cx == null) {
      cx = factory.makeContext();
      if (cx.enterCount != 0) {
        throw new IllegalStateException("factory.makeContext() returned Context instance already associated with some thread");
      }
      factory.onContextCreated(cx);
      if (factory.isSealed() && !cx.isSealed()) {
        cx.seal(null);
      }
    } else {
      if (cx.enterCount != 0) {
        throw new IllegalStateException("can not use Context instance already associated with some thread");
      }
    }
    VMBridge.instance.setContext(helper, cx);
  }
  ++cx.enterCount;
  return cx;
 }

相关文章

微信公众号

Context类方法