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

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

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

ScriptableObject.putConstProperty介绍

[英]Puts a named property in an object or in an object in its prototype chain.

Searches for the named property in the prototype chain. If it is found, the value of the property in obj is changed through a call to Scriptable#put(String,Scriptable,Object) on the prototype passing obj as the start argument. This allows the prototype to veto the property setting in case the prototype defines the property with ReadOnly attribute. If the property is not found, it is added in obj.
[中]将命名属性放入对象或其原型链中的对象中。
在原型链中搜索命名属性。如果找到它,obj中属性的值将通过调用原型上的Scriptable#put(String,Scriptable,Object)来更改,并将obj作为start参数传递。如果原型使用ReadOnly属性定义属性,则原型可以否决属性设置。如果找不到该属性,则将其添加到obj

代码示例

代码示例来源:origin: com.atlassian.pluginkit/ringojs-kit

public static void putConstProperty(Scriptable obj, String name, Object value)
{
  ScriptableObject.putConstProperty(obj, name, value);
}

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

public static Object setConst(Scriptable bound, Object value,
               Context cx, String id)
{
  if (bound instanceof XMLObject) {
    XMLObject xmlObject = (XMLObject)bound;
    xmlObject.ecmaPut(cx, id, value);
  } else {
    ScriptableObject.putConstProperty(bound, id, value);
  }
  return value;
}

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

public static Object setConst(Scriptable bound, Object value,
               Context cx, String id)
{
  if (bound instanceof XMLObject) {
    bound.put(id, bound, value);
  } else {
    ScriptableObject.putConstProperty(bound, id, value);
  }
  return value;
}

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

public static Object setConst(Scriptable bound, Object value,
               Context cx, String id)
{
  if (bound instanceof XMLObject) {
    bound.put(id, bound, value);
  } else {
    ScriptableObject.putConstProperty(bound, id, value);
  }
  return value;
}

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

public static Object setConst(Scriptable bound, Object value,
               Context cx, String id)
{
  if (bound instanceof XMLObject) {
    bound.put(id, bound, value);
  } else {
    ScriptableObject.putConstProperty(bound, id, value);
  }
  return value;
}

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

public static Object setConst(Scriptable bound, Object value,
               Context cx, String id)
{
  if (bound instanceof XMLObject) {
    bound.put(id, bound, value);
  } else {
    ScriptableObject.putConstProperty(bound, id, value);
  }
  return value;
}

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

public static Object setConst(Scriptable bound, Object value,
               Context cx, String id)
{
  if (bound instanceof XMLObject) {
    XMLObject xmlObject = (XMLObject)bound;
    xmlObject.ecmaPut(cx, id, value);
  } else {
    ScriptableObject.putConstProperty(bound, id, value);
  }
  return value;
}

代码示例来源:origin: mulesoft-labs/rhinodo

ScriptableObject.putConstProperty(scope, "__dirname", fullPath);
ScriptableObject.putConstProperty(scope, "__filename", fullPath);

相关文章

微信公众号

ScriptableObject类方法