From 1f58f05c524045301acab4ba5fbe30fb2af34a07 Mon Sep 17 00:00:00 2001 From: Pinaki Poddar Date: Wed, 22 Jul 2009 16:26:44 +0000 Subject: [PATCH] formatting git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@796784 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/persistence/util/SourceCode.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/util/SourceCode.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/util/SourceCode.java index 0bd44f056..2380336c8 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/util/SourceCode.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/util/SourceCode.java @@ -60,7 +60,7 @@ public class SourceCode { private static final String[] BRACKET_ARGS = {"(", ")"}; private static final String[] BRACKET_PARAMS = {"<", ">"}; - private Comment comment; + private List comments; private final Package pkg; private final Class cls; private final Set imports = new TreeSet(); @@ -106,9 +106,12 @@ public class SourceCode { public SourceCode addComment(boolean inline, String... lines) { if (lines == null) return this; - if (lines.length == 1 && lines[0].length() > 80) - return addComment(inline, wrap(lines[0], 80-4)); - if (comment == null) comment = new Comment(); + if (lines.length == 1 && lines[0].length() > 120) + return addComment(inline, wrap(lines[0], 120-4)); + if (comments == null) + comments = new ArrayList(); + Comment comment = new Comment(); + comments.add(comment); comment.makeInline(inline); for (String line:lines) comment.append(line); return this; @@ -119,9 +122,11 @@ public class SourceCode { * @param out */ public void write(PrintWriter out) { - if (comment != null) { - comment.write(out, 0); - out.println(); + if (comments != null) { + for (Comment comment : comments) { + comment.write(out, 0); + out.println(); + } } if (pkg != null) { pkg.write(out,0);