public class ExtractCommentsDoclet { public static boolean start(RootDoc root) throws IOException { for (ClassDoc c : root.classes()) { print(c.qualifiedName(), c.commentText()); for (FieldDoc f : c.fields(false)) { print(f.qualifiedName(), f.commentText()); } for (MethodDoc m : c.methods(false)) { print(m.qualifiedName(), m.commentText()); if (m.commentText() != null && m.commentText().length() > 0) { for (ParamTag p : m.paramTags()) print(m.qualifiedName() + "@" + p.parameterName(), p.parameterComment()); for (Tag t : m.tags("return")) { if (t.text() != null && t.text().length() > 0) print(m.qualifiedName() + "@return", t.text()); } } } } return true; } private static void print(String name, String comment) throws IOException { if (comment != null && comment.length() > 0) { new FileWriter(name + ".txt").append(comment).close(); } } }
protected void writeDeprecatedLink(ProgramElementDoc member) { writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, (MemberDoc) member, ((FieldDoc)member).qualifiedName(), false); }
/** * {@inheritDoc} */ protected Content getDeprecatedLink(ProgramElementDoc member) { return writer.getDocLink(LinkInfoImpl.Kind.MEMBER, (MemberDoc) member, ((FieldDoc)member).qualifiedName()); }
/** * {@inheritDoc} */ protected Content getDeprecatedLink(ProgramElementDoc member) { return writer.getDocLink(LinkInfoImpl.Kind.MEMBER, (MemberDoc) member, ((FieldDoc)member).qualifiedName()); }
protected void writeDeprecatedLink(ProgramElementDoc member) { writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, (MemberDoc) member, ((FieldDoc)member).qualifiedName(), false); }
private ParameterDescription getPublishedParameterDescription(ClassDescriptionSource source, FieldDoc fd, String name) { String currentClassName = fd.type().qualifiedTypeName(); while (true) { ClassDescription componentCD = source.getDescription(currentClassName); if (componentCD.classDoc == null) throw new IllegalArgumentException(String.format("Published parameter '%s' from %s not found.", name, fd.qualifiedName())); if (componentCD.parameters.containsKey(name)) { return componentCD.parameters.get(name); } currentClassName = componentCD.classDoc.superclass().typeName(); } }
private ParameterDescription getPublishedParameterDescription(ClassDescriptionSource source, FieldDoc fd, String name) { String currentClassName = fd.type().qualifiedTypeName(); while (true) { ClassDescription componentCD = source.getDescription(currentClassName); if (componentCD.classDoc == null) throw new IllegalArgumentException(String.format("Published parameter '%s' from %s not found.", name, fd.qualifiedName())); if (componentCD.parameters.containsKey(name)) { return componentCD.parameters.get(name); } currentClassName = componentCD.classDoc.superclass().typeName(); } }
if (!fieldDoc.qualifiedName().startsWith(normalizedTypeName)) { logger.warn(String.format( "Can't validate FieldDoc \"%s\" for member field \"%s\" in \"%s\" of type \"%s\".", fieldDoc.qualifiedName(), argDef.field.getName(), currentWorkUnit.getClazz().getCanonicalName(),
/** * Parses an enum type definition * * @param fieldDoc * @return */ protected EnumConstant parseEnumConstant(FieldDoc fieldDoc) { EnumConstant enumConstant = objectFactory.createEnumConstant(); enumConstant.setName(fieldDoc.name()); String comment = fieldDoc.commentText(); if (comment.length() > 0) { enumConstant.setComment(comment); } for (AnnotationDesc annotationDesc : fieldDoc.annotations()) { enumConstant.getAnnotation().add(parseAnnotationDesc(annotationDesc, fieldDoc.qualifiedName())); } for (Tag tag : fieldDoc.tags()) { enumConstant.getTag().add(parseTag(tag)); } return enumConstant; }
protected Field parseField(FieldDoc fieldDoc) { Field fieldNode = objectFactory.createField(); fieldNode.setType(parseTypeInfo(fieldDoc.type())); fieldNode.setName(fieldDoc.name()); fieldNode.setQualified(fieldDoc.qualifiedName()); String comment = fieldDoc.commentText(); if (comment.length() > 0) { fieldNode.setComment(comment); } fieldNode.setScope(parseScope(fieldDoc)); fieldNode.setFinal(fieldDoc.isFinal()); fieldNode.setStatic(fieldDoc.isStatic()); fieldNode.setVolatile(fieldDoc.isVolatile()); fieldNode.setTransient(fieldDoc.isTransient()); fieldNode.setConstant(fieldDoc.constantValueExpression()); for (AnnotationDesc annotationDesc : fieldDoc.annotations()) { fieldNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, fieldDoc.qualifiedName())); } for (Tag tag : fieldDoc.tags()) { fieldNode.getTag().add(parseTag(tag)); } return fieldNode; }