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

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

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

Scriptable.getIds介绍

[英]Get an array of property ids. Not all property ids need be returned. Those properties whose ids are not returned are considered non-enumerable.
[中]获取属性ID数组。并非所有的属性ID都需要返回。未返回ID的属性被视为不可枚举。

代码示例

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

public boolean isEmpty() {
  return scriptable.getIds().length == 0;
}

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

public int size() {
  return scriptable.getIds().length;
}

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

public TemplateCollectionModel keys() throws TemplateModelException {
  return (TemplateCollectionModel) wrapper.wrap(scriptable.getIds());
}

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

public TemplateCollectionModel values() throws TemplateModelException {
  Object[] ids = scriptable.getIds();
  Object[] values = new Object[ids.length];
  for (int i = 0; i < values.length; i++) {
    Object id = ids[i];
    if (id instanceof Number) {
      values[i] = ScriptableObject.getProperty(scriptable, 
          ((Number) id).intValue());
    } else {
      values[i] = ScriptableObject.getProperty(scriptable, 
          String.valueOf(id)); 
    }
  }
  return (TemplateCollectionModel) wrapper.wrap(values);
}

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

/**
 * @see org.mozilla.javascript.Scriptable#getIds
 */
public Object[] getIds() {
  return obj.getIds();
}
/**

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

public ScriptableIterator(Scriptable scope) {
  this.scope = scope;
  this.ids = scope.getIds();
  this.index = 0;
}

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

/**
 * @see org.mozilla.javascript.Scriptable#getIds
 */
public Object[] getIds() {
  return obj.getIds();
}
/**

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

/**
 * @see org.mozilla.javascript.Scriptable#getIds
 */
public Object[] getIds() {
  return obj.getIds();
}
/**

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

/**
 * @see org.mozilla.javascript.Scriptable#getIds
 */
public Object[] getIds() {
  return obj.getIds();
}
/**

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

/**
 * @see org.mozilla.javascript.Scriptable#getIds
 */
public Object[] getIds() {
  return obj.getIds();
}
/**

代码示例来源:origin: io.apigee.trireme/trireme-util

@Override
public Object[] getIds()
{
  return child.getIds();
}

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

/**
 * @see org.mozilla.javascript.Scriptable#getIds
 */
public Object[] getIds() {
  return obj.getIds();
}
/**

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

public Object[] getIds() {
  return prototype.getIds();
}

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

public Object[] getIds() {
  return prototype.getIds();
}

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

public int size() {
  return scriptable.getIds().length;
}

代码示例来源:origin: stackoverflow.com

Scriptable arr = (Scriptable) result;
Object [] array = new Object[arr.getIds().length];
for (Object o : arr.getIds()) {
  int index = (Integer) o;
  array[index] = arr.get(index, null);
}

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

public Object[] getIds(PageLocal local) {
  Scriptable obj = resolve(local);
  return obj.getIds();
}

代码示例来源:origin: apache/cxf

private Object[] compileScript(Context cx, String scriptStr, Scriptable scriptScope, File f) {
  int opt = cx.getOptimizationLevel();
  cx.setOptimizationLevel(-1);
  Script script = cx.compileString(scriptStr, f.getName(), 1, null);
  script.exec(cx, scriptScope);
  Object[] ids = scriptScope.getIds();
  cx.setOptimizationLevel(opt);
  script = cx.compileString(scriptStr, f.getName(), 1, null);
  script.exec(cx, scriptScope);
  return ids;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-js

private Object[] compileScript(Context cx, String scriptStr, Scriptable scriptScope, File f) {
  int opt = cx.getOptimizationLevel();
  cx.setOptimizationLevel(-1);
  Script script = cx.compileString(scriptStr, f.getName(), 1, null);
  script.exec(cx, scriptScope);
  Object[] ids = scriptScope.getIds();
  cx.setOptimizationLevel(opt);
  script = cx.compileString(scriptStr, f.getName(), 1, null);
  script.exec(cx, scriptScope);
  return ids;
}

代码示例来源:origin: org.apache.pig/pig

private DataBag jsToPigBag(Scriptable array, Schema schema, int depth) throws FrontendException, ExecException {
  debugConvertJSToPig(depth, "Bag", array, schema);
  if (schema.size() == 1 && schema.getField(0).type == DataType.TUPLE) {
    schema = schema.getField(0).schema;
  }
  List<Tuple> bag = new ArrayList<Tuple>();
  for (Object id : array.getIds()) {
    Scriptable arrayValue = (Scriptable)array.get(((Integer)id).intValue(), null);
    bag.add(jsToPigTuple(arrayValue, schema, depth + 1));
  }
  DataBag result = BagFactory.getInstance().newDefaultBag(bag);
  debugReturn(depth, result);
  return result;
}

相关文章