org.apache.tapestry5.json.JSONArray.putAll()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(131)

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

JSONArray.putAll介绍

[英]Puts all objects from the collection into this JSONArray, using #put(Object).
[中]使用#put(Object)将集合中的所有对象放入此JSONArray。

代码示例

代码示例来源:origin: apache/tapestry-5

/**
 * Create a new array, and adds all values fro the iterable to the array (using {@link #putAll(Iterable)}.
 *
 * This is implemented as a static method so as not to break the semantics of the existing {@link #JSONArray(Object...)} constructor.
 * Adding a constructor of type Iterable would change the meaning of <code>new JSONArray(new JSONArray())</code>.
 *
 * @param iterable
 *         collection ot value to include, or null
 * @since 5.4
 */
public static JSONArray from(Iterable<?> iterable)
{
  return new JSONArray().putAll(iterable);
}

代码示例来源:origin: org.apache.tapestry/tapestry-json

/**
 * Create a new array, and adds all values fro the iterable to the array (using {@link #putAll(Iterable)}.
 *
 * This is implemented as a static method so as not to break the semantics of the existing {@link #JSONArray(Object...)} constructor.
 * Adding a constructor of type Iterable would change the meaning of <code>new JSONArray(new JSONArray())</code>.
 *
 * @param iterable
 *         collection ot value to include, or null
 * @since 5.4
 */
public static JSONArray from(Iterable<?> iterable)
{
  return new JSONArray().putAll(iterable);
}

代码示例来源:origin: apache/tapestry-5

private String convert(List<?> input)
{
  return new JSONArray().putAll(input).toString(compactJSON);
}

代码示例来源:origin: apache/tapestry-5

public void addInitialization(InitializationPriority priority, String moduleName, String functionName, JSONArray arguments)
{
  assert priority != null;
  assert InternalUtils.isNonBlank(moduleName);
  String name = functionName == null ? moduleName : moduleName + ":" + functionName;
  if ((arguments == null || arguments.length() == 0))
  {
    if (pureInits.contains(name))
    {
      // A degenerate case is a pure init added repeatedly with different priorities. That isn't handled:
      // the first priority wins.
      return;
    }
    pureInits.add(name);
    InternalUtils.addToMapList(inits, priority, name);
  } else
  {
    JSONArray init = new JSONArray();
    init.put(name);
    init.putAll(arguments);
    InternalUtils.addToMapList(inits, priority, init);
  }
  initCount++;
}

相关文章