<T> String toString(Iterable<T> items, String sep) {
   String currSep = "";
   StringBuilder sb = new StringBuilder();
   for (T item : items) {
     sb.append(currSep);
     sb.append(item.toString());
     currSep = sep;
   }
   return sb.toString();
 }
Example #2
0
    /**
     * Returns a string representation of this annotation. String is of one of the forms:
     *
     * @com.example.foo(name1=val1, name2=val2)
     * @com.example.foo(val)
     * @com.example.foo Omit parens for marker annotations, and omit "value=" when allowed.
     */
    public String toString() {
      StringBuilder buf = new StringBuilder();
      buf.append("@");
      buf.append(type);
      int len = values.length();
      if (len > 0) {
        buf.append('(');
        boolean first = true;
        for (Pair<MethodSymbol, Attribute> value : values) {
          if (!first) buf.append(", ");
          first = false;

          Name name = value.fst.name;
          if (len > 1 || name != name.table.names.value) {
            buf.append(name);
            buf.append('=');
          }
          buf.append(value.snd);
        }
        buf.append(')');
      }
      return buf.toString();
    }
Example #3
0
 public String toString() {
   StringBuilder buf = new StringBuilder();
   buf.append('{');
   boolean first = true;
   for (Attribute value : values) {
     if (!first) buf.append(", ");
     first = false;
     buf.append(value);
   }
   buf.append('}');
   return buf.toString();
 }