コード例 #1
0
  private static void appendScriptToChain(StringBuilder builder, String script) {

    if ((script == null) || (script.length() == 0)) {
      return;
    }

    if (builder.charAt(builder.length() - 1) != ',') builder.append(',');

    appendQuotedValue(builder, script);
  }
コード例 #2
0
  public static void appendProperty(
      StringBuilder builder, String name, Object value, boolean quoteValue) {

    if ((null == name) || (name.length() == 0)) throw new IllegalArgumentException();

    char lastChar = builder.charAt(builder.length() - 1);
    if ((lastChar != ',') && (lastChar != '{')) builder.append(',');

    appendQuotedValue(builder, name);
    builder.append(":");

    if (value == null) {
      builder.append("''");
    } else if (quoteValue) {
      appendQuotedValue(builder, value.toString());
    } else {
      builder.append(value.toString());
    }
  }