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

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

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

JSONArray.from介绍

[英]Create a new array, and adds all values fro the iterable to the array (using #putAll(Iterable). This is implemented as a static method so as not to break the semantics of the existing #JSONArray(Object...) constructor. Adding a constructor of type Iterable would change the meaning of new JSONArray(new JSONArray()).
[中]创建一个新数组,并将iterable的所有值添加到数组中(使用#putAll(iterable))。这是作为静态方法实现的,以避免破坏现有#JSONArray(Object…)的语义构造器。添加Iterable类型的构造函数将更改new JSONArray(new JSONArray())的含义。

代码示例

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

/**
 * Returns an array containing the string names in this object. This method
 * returns null if this object contains no mappings.
 *
 * @return the names.
 */
public JSONArray names() {
  return nameValuePairs.isEmpty()
      ? null
      : JSONArray.from(nameValuePairs.keySet());
}

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

/**
 * Returns an array containing the string names in this object. This method
 * returns null if this object contains no mappings.
 *
 * @return the names.
 */
public JSONArray names() {
  return nameValuePairs.isEmpty()
      ? null
      : JSONArray.from(nameValuePairs.keySet());
}

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

reply.put("matches", JSONArray.from(matchesHolder.get()));

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

/**
   * Commits changes, adding one or more keys to the reply.
   *
   * @param reply
   *         JSON Object to be sent to client
   */
  public void commit(JSONObject reply)
  {
    if (libraryURLs.length() > 0)
    {
      reply.in(InternalConstants.PARTIAL_KEY).put("libraries", libraryURLs);
    }

    if (stylesheets.length() > 0)
    {
      reply.in(InternalConstants.PARTIAL_KEY).put("stylesheets", stylesheets);
    }

    List<?> inits = initsManager.getSortedInits();

    if (inits.size() > 0)
    {
      reply.in(InternalConstants.PARTIAL_KEY).put("inits", JSONArray.from(inits));
    }
  }
}

相关文章