com.google.gwt.json.client.JSONObject.computeKeys()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(100)

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

JSONObject.computeKeys介绍

暂无

代码示例

代码示例来源:origin: net.wetheinter/gwt-user

/**
 * Returns the set of properties defined on this JSONObject. The returned set
 * is immutable.
 */
public Set<String> keySet() {
 final String[] keys = computeKeys();
 return new AbstractSet<String>() {
  @Override
  public boolean contains(Object o) {
   return (o instanceof String) && containsKey((String) o);
  }
  @Override
  public Iterator<String> iterator() {
   return Arrays.asList(keys).iterator();
  }
  @Override
  public int size() {
   return keys.length;
  }
 };
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
 * Returns the set of properties defined on this JSONObject. The returned set
 * is immutable.
 */
public Set<String> keySet() {
 final String[] keys = computeKeys();
 return new AbstractSet<String>() {
  @Override
  public boolean contains(Object o) {
   return (o instanceof String) && containsKey((String) o);
  }
  @Override
  public Iterator<String> iterator() {
   return Arrays.asList(keys).iterator();
  }
  @Override
  public int size() {
   return keys.length;
  }
 };
}

代码示例来源:origin: net.wetheinter/gwt-user

/**
 * Converts a JSONObject into a JSON representation that can be used to
 * communicate with a JSON service.
 * 
 * @return a JSON string representation of this JSONObject instance
 */
@Override
public String toString() {
 StringBuilder sb = new StringBuilder("{");
 boolean first = true;
 String[] keys = computeKeys();
 for (String key : keys) {
  if (first) {
   first = false;
  } else {
   sb.append(", ");
  }
  sb.append(JsonUtils.escapeValue(key));
  sb.append(":");
  sb.append(get(key));
 }
 sb.append("}");
 return sb.toString();
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
 * Converts a JSONObject into a JSON representation that can be used to
 * communicate with a JSON service.
 * 
 * @return a JSON string representation of this JSONObject instance
 */
@Override
public String toString() {
 StringBuilder sb = new StringBuilder("{");
 boolean first = true;
 String[] keys = computeKeys();
 for (String key : keys) {
  if (first) {
   first = false;
  } else {
   sb.append(", ");
  }
  sb.append(JsonUtils.escapeValue(key));
  sb.append(":");
  sb.append(get(key));
 }
 sb.append("}");
 return sb.toString();
}

相关文章