@Override public void visitMethodDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT && !insideEnum && !insideAnonymousInnerClass()) { SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); if (currentClassDoc == null) { // assume we have a script if ("true".equals(properties.getProperty("processScripts", "true"))) { currentClassDoc = new SimpleGroovyClassDoc(importedClassesAndPackages, aliases, className, links); currentClassDoc.setFullPathName(packagePath + FS + className); currentClassDoc.setPublic(true); currentClassDoc.setScript(true); currentClassDoc.setGroovy(isGroovy); currentClassDoc.setSuperClassName("groovy/lang/Script"); if ("true".equals(properties.getProperty("includeMainForScripts", "true"))) { currentClassDoc.add(createMainMethod(currentClassDoc)); } classDocs.put(currentClassDoc.getFullPathName(), currentClassDoc); if (foundClasses == null) { foundClasses = new HashMap<String, SimpleGroovyClassDoc>(); } foundClasses.put(className, currentClassDoc); } else { return; } } SimpleGroovyMethodDoc currentMethodDoc = createMethod(t, currentClassDoc); currentClassDoc.add(currentMethodDoc); } }
@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); } }
@Override public void visitClassDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT) { SimpleGroovyClassDoc parent = getCurrentClassDoc(); String shortName = getIdentFor(t); String className = shortName; if (parent != null && isNested() && !insideAnonymousInnerClass()) { className = parent.name() + "." + className; } else { foundClasses = new HashMap<String, SimpleGroovyClassDoc>(); } SimpleGroovyClassDoc current = (SimpleGroovyClassDoc) classDocs.get(packagePath + FS + className); if (current == null) { current = new SimpleGroovyClassDoc(importedClassesAndPackages, aliases, className, links); current.setGroovy(isGroovy); } current.setRawCommentText(getJavaDocCommentsBeforeNode(t)); current.setFullPathName(packagePath + FS + current.name()); current.setTokenType(t.getType()); current.setNameWithTypeArgs(getIdentPlusTypeArgsFor(t)); processAnnotations(t, current); processModifiers(t, current); classDocs.put(current.getFullPathName(), current); foundClasses.put(shortName, current); if (parent != null) { parent.addNested(current); current.setOuter(parent); } } }
@Override public void visitVariableDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT && !insideAnonymousInnerClass() && isFieldDefinition()) { SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); if (currentClassDoc != null) { String fieldName = getIdentFor(t); currentFieldDoc = new SimpleGroovyFieldDoc(fieldName, currentClassDoc); currentFieldDoc.setRawCommentText(getJavaDocCommentsBeforeNode(t)); boolean isProp = processModifiers(t, currentFieldDoc); currentFieldDoc.setType(new SimpleGroovyType(getTypeOrDefault(t))); processAnnotations(t, currentFieldDoc); if (isProp) { currentClassDoc.addProperty(currentFieldDoc); } else { currentClassDoc.add(currentFieldDoc); } } } }
@Override public void visitMethodDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT && !insideEnum && !insideAnonymousInnerClass()) { SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); if (currentClassDoc == null) { // assume we have a script if ("true".equals(properties.getProperty("processScripts", "true"))) { currentClassDoc = getOrMakeScriptClassDoc(); } else { return; } } SimpleGroovyMethodDoc currentMethodDoc = createMethod(t, currentClassDoc); StringBuilder params = new StringBuilder(); getTypeParameters(t.childOfType(TYPE_PARAMETERS), params, "def"); currentMethodDoc.setTypeParameters(params.toString()); currentClassDoc.add(currentMethodDoc); } }
@Override public void visitClassDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT) { SimpleGroovyClassDoc parent = getCurrentClassDoc(); String shortName = getIdentFor(t); String className = shortName; if (parent != null && isNested() && !insideAnonymousInnerClass()) { className = parent.name() + "." + className; } else { foundClasses = new HashMap<String, SimpleGroovyClassDoc>(); } SimpleGroovyClassDoc current = (SimpleGroovyClassDoc) classDocs.get(packagePath + FS + className); if (current == null) { current = new SimpleGroovyClassDoc(importedClassesAndPackages, className, links); } current.setRawCommentText(getJavaDocCommentsBeforeNode(t)); current.setFullPathName(packagePath + FS + current.name()); current.setTokenType(t.getType()); processAnnotations(t, current); classDocs.put(current.getFullPathName(), current); foundClasses.put(shortName, current); if (parent != null) { parent.addNested(current); current.setOuter(parent); } } }
@Override public void visitClassDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT) { SimpleGroovyClassDoc parent = getCurrentClassDoc(); String shortName = getIdentFor(t); String className = shortName; if (parent != null && isNested() && !insideAnonymousInnerClass()) { className = parent.name() + "." + className; } else { foundClasses = new HashMap<String, SimpleGroovyClassDoc>(); } SimpleGroovyClassDoc current = (SimpleGroovyClassDoc) classDocs.get(packagePath + FS + className); if (current == null) { current = new SimpleGroovyClassDoc(importedClassesAndPackages, className, links); } current.setRawCommentText(getJavaDocCommentsBeforeNode(t)); current.setFullPathName(packagePath + FS + current.name()); current.setTokenType(t.getType()); processAnnotations(t, current); classDocs.put(current.getFullPathName(), current); foundClasses.put(shortName, current); if (parent != null) { parent.addNested(current); current.setOuter(parent); } } }
@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); } }
public void visitCtorIdent(GroovySourceAST t,int visit) { if (visit == OPENING_VISIT) { if (!insideAnonymousInnerClass()) { // now... get relevant values from the AST // name of class for the constructor currentConstructorDoc = new SimpleGroovyConstructorDoc(currentClassDoc.name()); // comments String commentText = getJavaDocCommentsBeforeNode(t); currentConstructorDoc.setRawCommentText(commentText); // modifiers processModifiers(t, currentConstructorDoc); addParametersTo(currentConstructorDoc, t, visit); // don't forget to tell the class about this constructor. currentClassDoc.add(currentConstructorDoc); } } }
@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); } }
@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); } }
@Override public void visitClassDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT) { SimpleGroovyClassDoc parent = getCurrentClassDoc(); String shortName = getIdentFor(t); String className = shortName; if (parent != null && isNested() && !insideAnonymousInnerClass()) { className = parent.name() + "." + className; } else { foundClasses = new HashMap<String, SimpleGroovyClassDoc>(); } SimpleGroovyClassDoc current = (SimpleGroovyClassDoc) classDocs.get(packagePath + FS + className); if (current == null) { current = new SimpleGroovyClassDoc(importedClassesAndPackages, aliases, className, links); current.setGroovy(isGroovy); } current.setRawCommentText(getJavaDocCommentsBeforeNode(t)); current.setFullPathName(packagePath + FS + current.name()); current.setTokenType(t.getType()); processAnnotations(t, current); processModifiers(t, current); classDocs.put(current.getFullPathName(), current); foundClasses.put(shortName, current); if (parent != null) { parent.addNested(current); current.setOuter(parent); } } }
@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); } }
@Override public void visitMethodDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT && !insideEnum && !insideAnonymousInnerClass()) { SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); if (currentClassDoc != null) { 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); currentClassDoc.add(currentMethodDoc); } } }
@Override public void visitMethodDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT && !insideEnum && !insideAnonymousInnerClass()) { SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); if (currentClassDoc != null) { 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); currentClassDoc.add(currentMethodDoc); } } }
public void visitMethodDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT) { if (!insideAnonymousInnerClass()) { // init // now... get relevant values from the AST // method name String methodName = t.childOfType(GroovyTokenTypes.IDENT).getText(); currentMethodDoc = new SimpleGroovyMethodDoc(methodName, links); // comments String commentText = getJavaDocCommentsBeforeNode(t); currentMethodDoc.setRawCommentText(commentText); // modifiers processModifiers(t, currentMethodDoc); // return type String returnTypeName = getTypeNodeAsText(t.childOfType(GroovyTokenTypes.TYPE),"def"); SimpleGroovyType returnType = new SimpleGroovyType(returnTypeName); // todo !!! currentMethodDoc.setReturnType(returnType); addParametersTo(currentMethodDoc, t, visit); // don't forget to tell the class about this method so carefully constructed. currentClassDoc.add(currentMethodDoc); } } }
@Override public void visitVariableDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT && !insideAnonymousInnerClass() && isFieldDefinition()) { SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); if (currentClassDoc != null) { String fieldName = getIdentFor(t); currentFieldDoc = new SimpleGroovyFieldDoc(fieldName, currentClassDoc); currentFieldDoc.setRawCommentText(getJavaDocCommentsBeforeNode(t)); boolean isProp = processModifiers(t, currentFieldDoc); currentFieldDoc.setType(new SimpleGroovyType(getTypeOrDefault(t))); processAnnotations(t, currentFieldDoc); if (isProp) { currentClassDoc.addProperty(currentFieldDoc); } else { currentClassDoc.add(currentFieldDoc); } } } }
@Override public void visitVariableDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT && !insideAnonymousInnerClass() && isFieldDefinition()) { SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); if (currentClassDoc != null) { String fieldName = getIdentFor(t); currentFieldDoc = new SimpleGroovyFieldDoc(fieldName, currentClassDoc); currentFieldDoc.setRawCommentText(getJavaDocCommentsBeforeNode(t)); boolean isProp = processModifiers(t, currentFieldDoc); currentFieldDoc.setType(new SimpleGroovyType(getTypeOrDefault(t))); processAnnotations(t, currentFieldDoc); if (isProp) { currentClassDoc.addProperty(currentFieldDoc); } else { currentClassDoc.add(currentFieldDoc); } } } }
@Override public void visitVariableDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT && !insideAnonymousInnerClass() && isFieldDefinition()) { SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); if (currentClassDoc != null) { String fieldName = getIdentFor(t); currentFieldDoc = new SimpleGroovyFieldDoc(fieldName, currentClassDoc); currentFieldDoc.setRawCommentText(getJavaDocCommentsBeforeNode(t)); boolean isProp = processModifiers(t, currentFieldDoc); currentFieldDoc.setType(new SimpleGroovyType(getTypeOrDefault(t))); processAnnotations(t, currentFieldDoc); if (isProp) { currentClassDoc.addProperty(currentFieldDoc); } else { currentClassDoc.add(currentFieldDoc); } } } }
public void visitVariableDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT) { if (!insideAnonymousInnerClass()) { GroovySourceAST parentNode = getParentNode(); // todo - what about fields in interfaces/enums etc if (parentNode != null && parentNode.getType() == GroovyTokenTypes.OBJBLOCK) { // this should restrict us to just field definitions, and not local variable definitions // field name String fieldName = t.childOfType(GroovyTokenTypes.IDENT).getText(); SimpleGroovyFieldDoc currentFieldDoc = new SimpleGroovyFieldDoc(fieldName); // comments - todo check this is doing the right thing for fields... String commentText = getJavaDocCommentsBeforeNode(t); currentFieldDoc.setRawCommentText(commentText); // modifiers processModifiers(t, currentFieldDoc); // type String typeName = getTypeNodeAsText(t.childOfType(GroovyTokenTypes.TYPE),"def"); SimpleGroovyType type = new SimpleGroovyType(typeName); // todo !!! currentFieldDoc.setType(type); // don't forget to tell the class about this field so carefully constructed. currentClassDoc.add(currentFieldDoc); } } } }