@Override public void visitEnumConstantDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT) { SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); insideEnum = true; String enumConstantName = getIdentFor(t); SimpleGroovyFieldDoc currentEnumConstantDoc = new SimpleGroovyFieldDoc(enumConstantName, currentClassDoc); currentEnumConstantDoc.setRawCommentText(getJavaDocCommentsBeforeNode(t)); processModifiers(t, currentEnumConstantDoc); String typeName = getTypeNodeAsText(t.childOfType(TYPE), currentClassDoc.getTypeDescription()); currentEnumConstantDoc.setType(new SimpleGroovyType(typeName)); currentClassDoc.addEnumConstant(currentEnumConstantDoc); } else if (visit == CLOSING_VISIT) { insideEnum = false; } }
@Override public void visitAnnotationFieldDef(GroovySourceAST t, int visit) { if (isGroovy && visit == OPENING_VISIT) { // TODO shouldn't really be treating annotation fields as methods - remove this hack SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); SimpleGroovyMethodDoc currentMethodDoc = createMethod(t, currentClassDoc); String defaultText = getDefaultValue(t); if (defaultText != null) { String orig = currentMethodDoc.getRawCommentText(); currentMethodDoc.setRawCommentText(orig + "\n* @default " + defaultText); } currentClassDoc.add(currentMethodDoc); } else if (visit == OPENING_VISIT) { // if (visit == OPENING_VISIT) { visitVariableDef(t, visit); String defaultText = getDefaultValue(t); if (isGroovy) { currentFieldDoc.setPublic(true); } if (defaultText != null) { currentFieldDoc.setConstantValueExpression(defaultText); String orig = currentFieldDoc.getRawCommentText(); currentFieldDoc.setRawCommentText(orig + "\n* @default " + defaultText); } } }
String typeName = fieldType.typeName(); if (visibleClasses.containsKey(typeName)) { mutableField.setType((GroovyType) visibleClasses.get(typeName)); } else { GroovyClassDoc doc = resolveClass(rootDoc, typeName); if (doc != null) mutableField.setType(doc); if (property instanceof SimpleGroovyFieldDoc) { SimpleGroovyFieldDoc simpleGroovyFieldDoc = (SimpleGroovyFieldDoc) property; if (simpleGroovyFieldDoc.type() instanceof SimpleGroovyType) { SimpleGroovyType simpleGroovyType = (SimpleGroovyType) simpleGroovyFieldDoc.type(); GroovyClassDoc propertyTypeClassDoc = resolveClass(rootDoc, simpleGroovyType.qualifiedTypeName()); if (propertyTypeClassDoc != null) { simpleGroovyFieldDoc.setType(propertyTypeClassDoc);
currentFieldDoc = new SimpleGroovyFieldDoc(fieldName, currentClassDoc); currentFieldDoc.setRawCommentText(getJavaDocCommentsBeforeNode(t)); boolean isProp = processModifiers(t, currentFieldDoc); currentFieldDoc.setType(new SimpleGroovyType(getTypeOrDefault(t))); processAnnotations(t, currentFieldDoc); if (!validField) { // look for @Field for (GroovyAnnotationRef ref : currentFieldDoc.annotations()) { if ("Field".equals(ref.name()) || "groovy/transform/Field".equals(ref.name())) { validField = true;
@Override public void visitAnnotationFieldDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT) { visitVariableDef(t, visit); String defaultText = getDefaultValue(t); if (defaultText != null) { currentFieldDoc.setConstantValueExpression(defaultText); String orig = currentFieldDoc.getRawCommentText(); currentFieldDoc.setRawCommentText(orig + "\n* @default " + defaultText); } } }
SimpleGroovyFieldDoc currentFieldDoc = new SimpleGroovyFieldDoc(fieldName, classDoc); currentFieldDoc.setType(new SimpleGroovyType(typeName)); } else { currentFieldDoc.setType(methodDoc.returnType());
String typeName = fieldType.typeName(); if (visibleClasses.containsKey(typeName)) { mutableField.setType((GroovyType) visibleClasses.get(typeName));
@Override public void visitAnnotationFieldDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT) { visitVariableDef(t, visit); String defaultText = getDefaultValue(t); if (defaultText != null) { currentFieldDoc.setConstantValueExpression(defaultText); String orig = currentFieldDoc.getRawCommentText(); currentFieldDoc.setRawCommentText(orig + "\n* @default " + defaultText); } } }
@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 visitAnnotationFieldDef(GroovySourceAST t, int visit) { if (isGroovy && visit == OPENING_VISIT) { // TODO shouldn't really be treating annotation fields as methods - remove this hack SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); SimpleGroovyMethodDoc currentMethodDoc = createMethod(t, currentClassDoc); String defaultText = getDefaultValue(t); if (defaultText != null) { String orig = currentMethodDoc.getRawCommentText(); currentMethodDoc.setRawCommentText(orig + "\n* @default " + defaultText); } currentClassDoc.add(currentMethodDoc); } else if (visit == OPENING_VISIT) { // if (visit == OPENING_VISIT) { visitVariableDef(t, visit); String defaultText = getDefaultValue(t); if (isGroovy) { currentFieldDoc.setPublic(true); } if (defaultText != null) { currentFieldDoc.setConstantValueExpression(defaultText); String orig = currentFieldDoc.getRawCommentText(); currentFieldDoc.setRawCommentText(orig + "\n* @default " + defaultText); } } }
String typeName = fieldType.typeName(); if (visibleClasses.containsKey(typeName)) { mutableField.setType((GroovyType) visibleClasses.get(typeName)); } else { GroovyClassDoc doc = resolveClass(rootDoc, typeName); if (doc != null) mutableField.setType(doc); if (property instanceof SimpleGroovyFieldDoc) { SimpleGroovyFieldDoc simpleGroovyFieldDoc = (SimpleGroovyFieldDoc) property; if (simpleGroovyFieldDoc.type() instanceof SimpleGroovyType) { SimpleGroovyType simpleGroovyType = (SimpleGroovyType) simpleGroovyFieldDoc.type(); GroovyClassDoc propertyTypeClassDoc = resolveClass(rootDoc, simpleGroovyType.qualifiedTypeName()); if (propertyTypeClassDoc != null) { simpleGroovyFieldDoc.setType(propertyTypeClassDoc);
@Override public void visitEnumConstantDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT) { SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); insideEnum = true; String enumConstantName = getIdentFor(t); SimpleGroovyFieldDoc currentEnumConstantDoc = new SimpleGroovyFieldDoc(enumConstantName, currentClassDoc); currentEnumConstantDoc.setRawCommentText(getJavaDocCommentsBeforeNode(t)); processModifiers(t, currentEnumConstantDoc); String typeName = getTypeNodeAsText(t.childOfType(TYPE), currentClassDoc.getTypeDescription()); currentEnumConstantDoc.setType(new SimpleGroovyType(typeName)); currentClassDoc.addEnumConstant(currentEnumConstantDoc); } else if (visit == CLOSING_VISIT) { insideEnum = false; } }
@Override public void visitAnnotationFieldDef(GroovySourceAST t, int visit) { if (isGroovy && visit == OPENING_VISIT) { // TODO shouldn't really be treating annotation fields as methods - remove this hack SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); SimpleGroovyMethodDoc currentMethodDoc = createMethod(t, currentClassDoc); String defaultText = getDefaultValue(t); if (defaultText != null) { String orig = currentMethodDoc.getRawCommentText(); currentMethodDoc.setRawCommentText(orig + "\n* @default " + defaultText); } currentClassDoc.add(currentMethodDoc); } else if (visit == OPENING_VISIT) { // if (visit == OPENING_VISIT) { visitVariableDef(t, visit); String defaultText = getDefaultValue(t); if (isGroovy) { currentFieldDoc.setPublic(true); } if (defaultText != null) { currentFieldDoc.setConstantValueExpression(defaultText); String orig = currentFieldDoc.getRawCommentText(); currentFieldDoc.setRawCommentText(orig + "\n* @default " + defaultText); } } }
String typeName = fieldType.typeName(); if (visibleClasses.containsKey(typeName)) { mutableField.setType((GroovyType) visibleClasses.get(typeName)); } else { GroovyClassDoc doc = resolveClass(rootDoc, typeName); if (doc != null) mutableField.setType(doc); if (property instanceof SimpleGroovyFieldDoc) { SimpleGroovyFieldDoc simpleGroovyFieldDoc = (SimpleGroovyFieldDoc) property; if (simpleGroovyFieldDoc.type() instanceof SimpleGroovyType) { SimpleGroovyType simpleGroovyType = (SimpleGroovyType) simpleGroovyFieldDoc.type(); GroovyClassDoc propertyTypeClassDoc = resolveClass(rootDoc, simpleGroovyType.qualifiedTypeName()); if (propertyTypeClassDoc != null) { simpleGroovyFieldDoc.setType(propertyTypeClassDoc);
@Override public void visitEnumConstantDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT) { SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); insideEnum = true; String enumConstantName = getIdentFor(t); SimpleGroovyFieldDoc currentEnumConstantDoc = new SimpleGroovyFieldDoc(enumConstantName, currentClassDoc); currentEnumConstantDoc.setRawCommentText(getJavaDocCommentsBeforeNode(t)); processModifiers(t, currentEnumConstantDoc); String typeName = getTypeNodeAsText(t.childOfType(TYPE), currentClassDoc.getTypeDescription()); currentEnumConstantDoc.setType(new SimpleGroovyType(typeName)); currentClassDoc.addEnumConstant(currentEnumConstantDoc); } else if (visit == CLOSING_VISIT) { insideEnum = false; } }
@Override public void visitEnumConstantDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT) { SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); insideEnum = true; String enumConstantName = getIdentFor(t); SimpleGroovyFieldDoc currentEnumConstantDoc = new SimpleGroovyFieldDoc(enumConstantName, currentClassDoc); currentEnumConstantDoc.setRawCommentText(getJavaDocCommentsBeforeNode(t)); processModifiers(t, currentEnumConstantDoc); String typeName = getTypeNodeAsText(t.childOfType(TYPE), currentClassDoc.getTypeDescription()); currentEnumConstantDoc.setType(new SimpleGroovyType(typeName)); currentClassDoc.addEnumConstant(currentEnumConstantDoc); } else if (visit == CLOSING_VISIT) { insideEnum = false; } }
@Override public void visitEnumConstantDef(GroovySourceAST t, int visit) { if (visit == OPENING_VISIT) { SimpleGroovyClassDoc currentClassDoc = getCurrentClassDoc(); insideEnum = true; String enumConstantName = getIdentFor(t); SimpleGroovyFieldDoc currentEnumConstantDoc = new SimpleGroovyFieldDoc(enumConstantName, currentClassDoc); currentEnumConstantDoc.setRawCommentText(getJavaDocCommentsBeforeNode(t)); processModifiers(t, currentEnumConstantDoc); String typeName = getTypeNodeAsText(t.childOfType(TYPE), currentClassDoc.getTypeDescription()); currentEnumConstantDoc.setType(new SimpleGroovyType(typeName)); currentClassDoc.addEnumConstant(currentEnumConstantDoc); } else if (visit == CLOSING_VISIT) { insideEnum = false; } }
@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); } } } }