@Override public void visitCtorIdent(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT && !insideEnum && !insideAnonymousInnerClass()) { SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); SimpleGroovyConstructorDoc currentConstructorDoc = new SimpleGroovyConstructorDoc(currentClassDoc.name(), currentClassDoc); currentConstructorDoc.setRawCommentText(getJavaDocCommentsBeforeNode(t)); processModifiers(t, currentConstructorDoc); addParametersTo(t, currentConstructorDoc); processAnnotations(t, currentConstructorDoc); currentClassDoc.add(currentConstructorDoc); } }
private SimpleGroovyMethodDoc createMethod(GroovySourceAST t, SimpleGroovyClassDoc currentClassDoc) { String methodName = getIdentFor(t); SimpleGroovyMethodDoc currentMethodDoc = new SimpleGroovyMethodDoc(methodName, currentClassDoc); currentMethodDoc.setRawCommentText(getJavaDocCommentsBeforeNode(t)); processModifiers(t, currentMethodDoc); currentMethodDoc.setReturnType(new SimpleGroovyType(getTypeOrDefault(t))); addParametersTo(t, currentMethodDoc); processAnnotations(t, currentMethodDoc); return currentMethodDoc; }
/** * Create link to Javadoc/GroovyDoc output at the given URL. * * @return link argument to configure */ public LinkArgument createLink() { LinkArgument result = new LinkArgument(); links.add(result); return result; }
private void adjustForAutomaticEnumMethods(SimpleGroovyClassDoc currentClassDoc) { SimpleGroovyMethodDoc valueOf = new SimpleGroovyMethodDoc("valueOf", currentClassDoc); valueOf.setRawCommentText("Returns the enum constant of this type with the specified name."); SimpleGroovyParameter parameter = new SimpleGroovyParameter("name"); parameter.setTypeName("String"); valueOf.add(parameter); valueOf.setReturnType(new SimpleGroovyType(currentClassDoc.name())); currentClassDoc.add(valueOf); SimpleGroovyMethodDoc values = new SimpleGroovyMethodDoc("values", currentClassDoc); values.setRawCommentText("Returns an array containing the constants of this enum type, in the order they are declared."); values.setReturnType(new SimpleGroovyType(currentClassDoc.name() + "[]")); currentClassDoc.add(values); }
private GroovyMethodDoc createMainMethod(SimpleGroovyClassDoc currentClassDoc) { SimpleGroovyMethodDoc mainMethod = new SimpleGroovyMethodDoc("main", currentClassDoc); mainMethod.setPublic(true); mainMethod.setStatic(true); mainMethod.setCommentText("Implicit main method for Groovy Scripts"); mainMethod.setFirstSentenceCommentText(mainMethod.commentText()); SimpleGroovyParameter args = new SimpleGroovyParameter("args"); GroovyType argsType = new SimpleGroovyType("java.lang.String[]"); args.setType(argsType); mainMethod.add(args); GroovyType returnType = new SimpleGroovyType("void"); mainMethod.setReturnType(returnType); return mainMethod; }
@Override public void visitExtendsClause(GroovySourceAST t, int visit) { SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); if (visit == OPENING_VISIT) { for (GroovySourceAST superClassNode : findTypeNames(t)) { String superClassName = extractName(superClassNode); if (currentClassDoc.isInterface()) { currentClassDoc.addInterfaceName(superClassName); } else { currentClassDoc.setSuperClassName(superClassName); } } } }
public String firstSentenceCommentText() { if (super.firstSentenceCommentText() == null) { SimpleGroovyClassDoc classDoc = (SimpleGroovyClassDoc) belongsToClass; setFirstSentenceCommentText(classDoc.replaceTags(calculateFirstSentence(getRawCommentText()))); } return super.firstSentenceCommentText(); }
public String firstSentenceCommentText() { if (super.firstSentenceCommentText() == null) setFirstSentenceCommentText(replaceTags(calculateFirstSentence(getRawCommentText()))); return super.firstSentenceCommentText(); }
/* package private */ void processPackageInfo(String src, String filename, SimpleGroovyPackageDoc packageDoc) { String relPath = packageDoc.getRelativeRootPath(); String description = calcThenSetPackageDescription(src, filename, relPath); packageDoc.setDescription(description); // get same description but with paths relative to root String altDescription = calcThenSetPackageDescription(src, filename, ""); calcThenSetSummary(altDescription, packageDoc); }
@Override public void visitImplementsClause(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT) { for (GroovySourceAST classNode : findTypeNames(t)) { getCurrentClassDoc().addInterfaceName(extractName(classNode)); } } }
public String commentText() { if (super.commentText() == null) { SimpleGroovyClassDoc classDoc = (SimpleGroovyClassDoc) belongsToClass; setCommentText(classDoc.replaceTags(getRawCommentText())); } return super.commentText(); }
public String commentText() { if (super.commentText() == null) setCommentText(replaceTags(getRawCommentText())); return super.commentText(); }
private void processAnnotationRefs(GroovyRootDoc rootDoc, GroovyAnnotationRef[] annotations) { for (GroovyAnnotationRef annotation : annotations) { SimpleGroovyAnnotationRef ref = (SimpleGroovyAnnotationRef) annotation; ref.setType(resolveClass(rootDoc, ref.name())); } }
public void writeRoot(GroovyRootDoc rootDoc, String destdir) throws Exception { output.makeOutputArea(destdir); writeRootDocToOutput(rootDoc, destdir); }
private boolean insideInterface(SimpleGroovyAbstractableElementDoc memberOrClass) { SimpleGroovyClassDoc current = getCurrentClassDoc(); if (current == null || current == memberOrClass) return false; return current.isInterface(); }
private void calcThenSetOverviewDescription(String src) { String description = scrubOffExcessiveTags(src); rootDoc.setDescription(description); }
@Override public void visitPackageDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT && deferSetup) { String packageWithSlashes = extractImportPath(t); setUpImports(packageWithSlashes, links, isGroovy, className); } }
private boolean insideAnnotationDef(SimpleGroovyAbstractableElementDoc memberOrClass) { SimpleGroovyClassDoc current = getCurrentClassDoc(); if (current == null || current == memberOrClass) return false; return current.isAnnotationType(); }
private GroovyDocTool makeHtmltool(ArrayList<LinkArgument> links, Properties props) { return new GroovyDocTool( new FileSystemResourceManager("src/main/resources"), // template storage new String[] {"src/test/groovy", "../../src/test"}, // source file dirs GroovyDocTemplateInfo.DEFAULT_DOC_TEMPLATES, GroovyDocTemplateInfo.DEFAULT_PACKAGE_TEMPLATES, GroovyDocTemplateInfo.DEFAULT_CLASS_TEMPLATES, links, props ); }
private void addAnnotationRefs(SimpleGroovyProgramElementDoc node, List<GroovySourceAST> nodes) { for (GroovySourceAST t : nodes) { addAnnotationRef(node, t); } }