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

x33g5p2x  于2022-01-30 转载在 JavaScript  
字(5.7k)|赞(0)|评价(0)|浏览(197)

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

ScriptableObject.put介绍

[英]Sets the value of the indexed property, creating it if need be.
[中]设置索引属性的值,并在需要时创建它。

代码示例

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

protected final void defaultPut(String name, Object value)
{
  super.put(name, this, value);
}

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

protected final void defaultPut(String name, Object value)
{
  super.put(name, this, value);
}

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

protected final void defaultPut(String name, Object value)
{
  super.put(name, this, value);
}

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

public void put(String name, Scriptable start, Object value) {
  if (KEY_CURRENT.equals(name) == false) {
    super.put(name, start, value);
  }
}

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

/** Invoked after script execution */
void onExec() {
  this.useSession = false;
  super.put(LAST_EXEC_TIME, this, new Long(System.currentTimeMillis()));
}

代码示例来源:origin: org.eiichiro.gig/gig-core

/**
 * Sets the specified configuration setting with the specified key.
 * 
 * @param key The key to the configuration setting.
 * @param value The value of the configuration setting.
 */
public <T> void set(String key, T value) {
  Preconditions.checkArgument(key != null && !key.isEmpty(), "Parameter 'key' must not be [" + key + "]");
  values.put(key, value);
  scope.put(key, scope, value);
}

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

public void put(int index, Scriptable start, Object value) {
  if (scope == null) {
     super.put(index, start, value);
  } else {
    scope.put(this, index, value);
  }
}

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

@Override
public void put(String name, Scriptable start, Object value) {
  if (this == thePrototypeInstance)
    super.put(name, start, value);
  else
    System.getProperties().put(name, ScriptRuntime.toString(value));
}

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

public void put(String name, Scriptable start, Object value) {
  if (scope == null) {
     super.put(name, start, value);
  } else {
    scope.put(this, name, value);
  }
}

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

@Override
public void put(String name, Scriptable start, Object value) {
  if (this == thePrototypeInstance)
    super.put(name, start, value);
  else
    System.getProperties().put(name, ScriptRuntime.toString(value));
}

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

public void setAttribute(String name, Object attribute) {
  if (KEY_CURRENT.equals(name)) {
    if (attribute instanceof PageAttributeScope) {
      super.put(name, this, attribute);
    }
    return;
  }
  put(name, this, attribute);
}

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

public Object run(Context cx) {
    Object o = object;
    if (name.equals(BIND_NAME_WINDOW) && object instanceof Window) {
      ((WindowWrapper) globalObject).window = (Window) object;
      window = (Window) object;
      o = globalObject;
    }
    Scriptable jsObject;
    jsObject = Context.toObject(o, globalObject);
    globalObject.put(name, globalObject, jsObject);
    return null;
  }
});

代码示例来源:origin: javanettasks/httpunit

public void setParameterValue( String name, String value ) {
  Object control = get( name, null );
  if (control instanceof ScriptableObject) ((ScriptableObject) control).put( "value", this, value );
}

代码示例来源:origin: org.kohsuke.httpunit/httpunit

public void put( String propertyName, Scriptable scriptable, Object value ) {
  if (_scriptable == null || _scriptable.get( propertyName ) == null) {
    super.put( propertyName, scriptable, value );
  } else {
    _scriptable.set( propertyName, value );
  }
}

代码示例来源:origin: org.verapdf/core

private void updateVariableForObjectWithType(Object object, String objectType) {
  for (Variable var : this.profile.getVariablesByObject(objectType)) {
    if (var == null) {
      continue;
    }
    java.lang.Object variable = JavaScriptEvaluator.evalVariableResult(var, object, this.scope);
    this.scope.put(var.getName(), this.scope, variable);
  }
}

代码示例来源:origin: veraPDF/veraPDF-library

private void updateVariableForObjectWithType(Object object, String objectType) {
  for (Variable var : this.profile.getVariablesByObject(objectType)) {
    if (var == null) {
      continue;
    }
    java.lang.Object variable = JavaScriptEvaluator.evalVariableResult(var, object, this.scope);
    this.scope.put(var.getName(), this.scope, variable);
  }
}

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

public void put(int index, Scriptable start, Object value) {
  // FIXME(SW): do indexed properties have a meaning on the global scope?
  if (this.locked && !has(index, start)) {
    throw new WrappedException(new JavaScriptException("Global scope locked. Cannot set value for index " + index));
  }
  this.useSession = true;
  super.put(index, start, value);
}

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

public void put(String name, Scriptable start, Object value) {
  //Allow setting values to existing variables, or if this is a
  //java class (used by importClass & importPackage)
  if (this.locked && !has(name, start) && !(value instanceof NativeJavaClass) && !(value instanceof Function)) {
    // Need to wrap into a runtime exception as Scriptable.put has no throws clause...
    throw new WrappedException (new JavaScriptException("Implicit declaration of global variable '" + name +
     "' forbidden. Please ensure all variables are explicitely declared with the 'var' keyword"));
  }
  this.useSession = true;
  super.put(name, start, value);
}

代码示例来源:origin: org.verapdf/core

private void initializeAllVariables() {
  for (Variable var : this.profile.getVariables()) {
    if (var == null)
      continue;
    java.lang.Object res = JavaScriptEvaluator.evaluateString(var.getDefaultValue(), this.scope);
    if (res instanceof NativeJavaObject) {
      res = ((NativeJavaObject) res).unwrap();
    }
    this.scope.put(var.getName(), this.scope, res);
  }
}

代码示例来源:origin: veraPDF/veraPDF-library

private void initializeAllVariables() {
  for (Variable var : this.profile.getVariables()) {
    if (var == null)
      continue;
    java.lang.Object res = JavaScriptEvaluator.evaluateString(var.getDefaultValue(), this.scope);
    if (res instanceof NativeJavaObject) {
      res = ((NativeJavaObject) res).unwrap();
    }
    this.scope.put(var.getName(), this.scope, res);
  }
}

相关文章

微信公众号

ScriptableObject类方法