示例#1
0
  public String toJSON() {
    StringBuilder b = new StringBuilder();
    b.append("{");
    b.append(toKeyValue("key", key));
    b.append(toKeyValue("questionText", questionText));
    b.append(toKeyValue("rating", String.valueOf(rating)));
    b.append("}");

    return b.toString();
  }
示例#2
0
  public String toString() {
    StringBuilder b = new StringBuilder();
    Key k = KeyFactory.stringToKey(key);
    b.append("Question (").append(k.getId()).append(") : ").append(" Text=").append(questionText);
    b.append(" Date Posted=").append(datePosted);
    b.append(" ParentInfo = ").append(k.getParent().toString());
    b.append("\n");

    for (Comment c : comments) {
      b.append("\t\t").append(c.toString()).append("\n");
    }

    return b.toString();
  }