You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pp...@apache.org on 2009/07/22 18:26:45 UTC

svn commit: r796784 - /openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/util/SourceCode.java

Author: ppoddar
Date: Wed Jul 22 16:26:44 2009
New Revision: 796784

URL: http://svn.apache.org/viewvc?rev=796784&view=rev
Log:
formatting

Modified:
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/util/SourceCode.java

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/util/SourceCode.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/util/SourceCode.java?rev=796784&r1=796783&r2=796784&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/util/SourceCode.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/util/SourceCode.java Wed Jul 22 16:26:44 2009
@@ -60,7 +60,7 @@
 	private static final String[] BRACKET_ARGS   = {"(", ")"};
     private static final String[] BRACKET_PARAMS = {"<", ">"};
 	
-	private Comment comment;
+	private List<Comment> comments;
 	private final Package pkg;
 	private final Class   cls;
     private final Set<Import> imports = new TreeSet<Import>();
@@ -106,9 +106,12 @@
 	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 comment = new Comment();
+		comments.add(comment);
 		comment.makeInline(inline);
 		for (String line:lines) comment.append(line);
 		return this;
@@ -119,9 +122,11 @@
 	 * @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);