@Override public void visit(JavadocComment n, Void arg) { out.println("JavadocComment: " + (extended ? n : n.getContent())); super.visit(n, arg); }
@Override public void visit(BlockComment n, Void arg) { out.println("BlockComment: " + (extended ? n : n.getContent())); super.visit(n, arg); }
@Override public void visit(LineComment n, Void arg) { out.println("LineComment: " + (extended ? n : n.getContent())); super.visit(n, arg); }
@Override public JavadocComment doMerge(JavadocComment first, JavadocComment second) { JavadocComment comment = new JavadocComment(); if(first.getContent().length() > second.getContent().length()){ comment.setContent(first.getContent()); copyPosition(first,comment); }else { comment.setContent(second.getContent()); copyPosition(second,comment); } return comment; }
@Override public void visit(ClassOrInterfaceDeclaration node, Void arg) { super.visit(node, arg); replaceParentClassesForAtomics(node); node.setName(translateQueueName(node.getNameAsString())); if (MPSC_LINKED_ATOMIC_QUEUE_NAME.equals(node.getNameAsString())) { /* * Special case for MPSC */ node.removeModifier(Modifier.ABSTRACT); node.addModifier(Modifier.FINAL); } if (isCommentPresent(node, GEN_DIRECTIVE_CLASS_CONTAINS_ORDERED_FIELD_ACCESSORS)) { node.setComment(null); removeStaticFieldsAndInitialisers(node); patchAtomicFieldUpdaterAccessorMethods(node); } for (MethodDeclaration method : node.getMethods()) { if (isCommentPresent(method, GEN_DIRECTIVE_METHOD_IGNORE)) { method.remove(); } } node.setJavadocComment(formatMultilineJavadoc(0, "NOTE: This class was automatically generated by " + JavaParsingAtomicLinkedQueueGenerator.class.getName(), "which can found in the jctools-build module. The original source file is " + sourceFileName + ".") + node.getJavadocComment().orElse(new JavadocComment("")).getContent()); }
private static boolean isCommentPresent(Node node, String wanted) { Optional<Comment> maybeComment = node.getComment(); if (maybeComment.isPresent()) { Comment comment = maybeComment.get(); String content = comment.getContent().trim(); if (wanted.equals(content)) { return true; } } return false; }
@Override public BlockComment doMerge(BlockComment first, BlockComment second) { if(StringUtils.isBlank(first.getContent())) return second; if(StringUtils.isBlank(second.getContent())) return first; BlockComment comment = new BlockComment(); comment.setContent(first.getContent()); copyPosition(first,comment); return comment; }
@Override public LineComment doMerge(LineComment first, LineComment second) { LineComment comment = new LineComment(); comment.setContent(first.getContent()); copyPosition(first,comment); return comment; }
private Javadoc toJavaDoc(Comment comment) { return comment.asJavadocComment().parse(); }
if( method.hasComment() && method.getComment() instanceof JavadocComment ){ JavadocComment javaDoc = (JavadocComment)method.getComment(); // now you can get the content using String content = javaDoc.getContent(); }
@Override public void visit(ClassOrInterfaceDeclaration node, Void arg) { super.visit(node, arg); replaceParentClassesForAtomics(node); node.setName(translateQueueName(node.getNameAsString())); if (isCommentPresent(node, GEN_DIRECTIVE_CLASS_CONTAINS_ORDERED_FIELD_ACCESSORS)) { node.setComment(null); removeStaticFieldsAndInitialisers(node); patchAtomicFieldUpdaterAccessorMethods(node); } for (MethodDeclaration method : node.getMethods()) { if (isCommentPresent(method, GEN_DIRECTIVE_METHOD_IGNORE)) { method.remove(); } } if (!node.getMethodsByName("failFastOffer").isEmpty()) { MethodDeclaration deprecatedMethodRedirect = node.addMethod("weakOffer", Modifier.PUBLIC); patchMethodAsDepreciatedRedirector(deprecatedMethodRedirect, "failFastOffer", PrimitiveType.intType(), new Parameter(classType("E"), "e")); } node.setJavadocComment(formatMultilineJavadoc(0, "NOTE: This class was automatically generated by " + JavaParsingAtomicArrayQueueGenerator.class.getName(), "which can found in the jctools-build module. The original source file is " + sourceFileName + ".") + node.getJavadocComment().orElse(new JavadocComment("")).getContent()); }
private static boolean isCommentPresent(Node node, String wanted) { Optional<Comment> maybeComment = node.getComment(); if (maybeComment.isPresent()) { Comment comment = maybeComment.get(); String content = comment.getContent().trim(); if (wanted.equals(content)) { return true; } } return false; }
@Override public boolean doIsEquals(BlockComment first, BlockComment second) { return similarity(first.getContent(),second.getContent()) > 0.9d; } }
@Override public boolean doIsEquals(LineComment first, LineComment second) { return similarity(first.getContent(),second.getContent()) > 0.9d; } }
private Javadoc toJavaDoc(Comment comment) { return comment.asJavadocComment().parse(); }
@Override public boolean doIsEquals(JavadocComment first, JavadocComment second) { return similarity(first.getContent(), second.getContent()) > 0.9d; } }
/** * Add the comment content. * * @param comment BlockComment on the route method. * @param route The route model that we construct. */ @Override public void visit(BlockComment comment, ControllerRouteModel route) { route.setDescription(comment.getContent()); }
/** * Get a text description from JavaDoc block comment. * * @param jdoc the javadoc block comment. * @return The description as String. */ public static String extractDescription(JavadocComment jdoc){ String content = jdoc.getContent().replaceAll("\n[ \t]+\\* ?","\n"); //remove the * at the beginning of a line int end = content.indexOf("\n@"); //look for the first annotation //The first charater is always a new line if(end>0) { return content.substring(1, end).trim(); } return content.substring(1).trim(); }
public static Javadoc parse(JavadocComment comment) { return parse(comment.getContent()); }
public static Javadoc parse(JavadocComment comment) { return parse(comment.getContent()); }