/** * Adapt a roo comment to antlr-java-parser comment * * @param antlrComment * @return */ private static org.springframework.roo.classpath.details.comments.AbstractComment adaptToRooComment( final Comment antlrComment) { org.springframework.roo.classpath.details.comments.AbstractComment comment; if (antlrComment instanceof LineComment) { comment = new org.springframework.roo.classpath.details.comments.LineComment(); } else if (antlrComment instanceof JavadocComment) { comment = new org.springframework.roo.classpath.details.comments.JavadocComment(); } else { comment = new org.springframework.roo.classpath.details.comments.BlockComment(); } comment.setComment(antlrComment.getContent()); return comment; }
/** * Format a given comment with the indent level specified. * * @param comment * @param indentLevel * @return */ public String format(Comment comment, int indentLevel, CommentLocation commentLocation) { // Return if there's nothing to do if (comment == null || comment.getContent() == null) { return null; } return format(comment.getContent(), indentLevel, commentLocation); }
/** * Format a given comment with the indent level specified. * * @param comment * @param indentLevel * @return */ public String format(Comment comment, int indentLevel, CommentLocation commentLocation) { // Return if there's nothing to do if (comment == null || comment.getContent() == null) { return null; } return format(comment.getContent(), indentLevel, commentLocation); }
private void printComment(Comment comment, int indentLevel, CommentFormatter.CommentLocation commentLocation) { // Return if there's nothing to do if (comment == null || comment.getContent() == null) { return; } String commentAsString = commentFormatter.format(comment, indentLevel, commentLocation); // Comment ends with newline boolean endsWithNewline = (commentAsString.endsWith("\r\n") || commentAsString.endsWith("\n")); printer.printRaw(commentAsString, !endsWithNewline); }
private void printComment(Comment comment, int indentLevel, CommentFormatter.CommentLocation commentLocation) { // Return if there's nothing to do if (comment == null || comment.getContent() == null) { return; } String commentAsString = commentFormatter.format(comment, indentLevel, commentLocation); // Comment ends with newline boolean endsWithNewline = (commentAsString.endsWith("\r\n") || commentAsString.endsWith("\n")); printer.printRaw(commentAsString, !endsWithNewline); }