protected void emitAllElements(StringBuilder sb, Document document) { if (myAlternateValue != null) { /** protect body of method from removing newlines. */ int brace = myAlternateValue.indexOf('{'); String temp = ""; if (brace >= 0) { // every method should have an open brace -- unless it is abstract. temp = myAlternateValue.substring(brace + 1, myAlternateValue.length()); myAlternateValue = myAlternateValue.substring(0, brace + 1); } super.emitAllElements(sb, document); sb.append(temp); } else { super.emitAllElements(sb, document); } }
public void checkForComment() { if (CommentUtil.getCommentMatchers().size() == 0) { return; } createAlternateValueString(); /** * we don't want to check for comments in the body of the method. So reduce the alternate value * string to only that text up to and including the open brace. Temporarily remove the rest of * the text; append it again after checking for comments. */ int brace = myAlternateValue.indexOf('{'); String temp = ""; if (brace >= 0) { // every method should have an open brace -- unless it is abstract. temp = myAlternateValue.substring(brace + 1, myAlternateValue.length()); myAlternateValue = myAlternateValue.substring(0, brace + 1); } super.checkForComment(); myAlternateValue += temp; }