if (LOG.isLoggable(Level.FINE)) { LOG.fine("Skipping empty inline tag of @response.param in method " + methodDoc.qualifiedName() + ": " + tagName); default: LOG.warning("Unknown inline tag of @response.param in method " + methodDoc.qualifiedName() + ": " + tagName + " (value: " + tagText + ")"); break;
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(); } } }
private static void addRequestRepresentationDoc(final MethodDoc methodDoc, final MethodDocType methodDocType) { final Tag requestElement = getSingleTagOrNull(methodDoc, "request.representation.qname"); final Tag requestExample = getSingleTagOrNull(methodDoc, "request.representation.example"); if (requestElement != null || requestExample != null) { final RequestDocType requestDoc = new RequestDocType(); final RepresentationDocType representationDoc = new RepresentationDocType(); /* requestElement exists */ if (requestElement != null) { representationDoc.setElement(QName.valueOf(requestElement.text())); } /* requestExample exists */ if (requestExample != null) { final String example = getSerializedExample(requestExample); if (!isEmpty(example)) { representationDoc.setExample(example); } else { LOG.warning("Could not get serialized example for method " + methodDoc.qualifiedName()); } } requestDoc.setRepresentationDoc(representationDoc); methodDocType.setRequestDoc(requestDoc); } }
/** * {@inheritDoc} */ protected Content getDeprecatedLink(ProgramElementDoc member) { return writer.getDocLink(LinkInfoImpl.Kind.MEMBER, (MemberDoc) member, ((MethodDoc)member).qualifiedName()); }
public static MethodIdentity create(MethodDoc method) { final List<String> parameterTypeNames = new ArrayList<String>(); for (Parameter param: method.parameters()) { Type type = param.type(); parameterTypeNames.add(type.qualifiedTypeName() + type.dimension()); } return new MethodIdentity(method.qualifiedName(), parameterTypeNames); }
public static boolean start(RootDoc root) throws IOException { String dumpFileName = readOptions(root.options()); OutputStream os = Files.newOutputStream(Paths.get(dumpFileName)); Properties javaDocMap = new Properties(); for (ClassDoc classDoc : root.classes()) { javaDocMap.put(classDoc.toString(), classDoc.commentText()); for (MethodDoc method : classDoc.methods()) { javaDocMap.put(method.qualifiedName(), method.commentText()); for (ParamTag paramTag : method.paramTags()) { Parameter[] parameters = method.parameters(); for (int i = 0; i < parameters.length; ++i) { if (parameters[i].name().equals(paramTag.parameterName())) { javaDocMap.put(method.qualifiedName() + ".paramCommentTag." + i, paramTag.parameterComment()); } } } Tag[] retTags = method.tags("return"); if (retTags != null && retTags.length == 1) { Tag retTag = method.tags("return")[0]; javaDocMap.put(method.qualifiedName() + "." + "returnCommentTag", retTag.text()); } } } javaDocMap.store(os, ""); os.flush(); os.close(); return true; }
public static boolean start(RootDoc root) throws IOException { String dumpFileName = readOptions(root.options()); OutputStream os = Files.newOutputStream(Paths.get(dumpFileName)); Properties javaDocMap = new Properties(); for (ClassDoc classDoc : root.classes()) { javaDocMap.put(classDoc.toString(), classDoc.commentText()); for (MethodDoc method : classDoc.methods()) { javaDocMap.put(method.qualifiedName(), method.commentText()); for (ParamTag paramTag : method.paramTags()) { Parameter[] parameters = method.parameters(); for (int i = 0; i < parameters.length; ++i) { if (parameters[i].name().equals(paramTag.parameterName())) { javaDocMap.put(method.qualifiedName() + ".paramCommentTag." + i, paramTag.parameterComment()); } } } Tag[] retTags = method.tags("return"); if (retTags != null && retTags.length == 1) { Tag retTag = method.tags("return")[0]; javaDocMap.put(method.qualifiedName() + "." + "returnCommentTag", retTag.text()); } } } javaDocMap.store(os, ""); os.flush(); os.close(); return true; }
if ( LOG.isLoggable( Level.FINE ) ) { LOG.fine( "Skipping empty inline tag of @response.param in method " + methodDoc.qualifiedName() + ": " + tagName ); methodDoc.qualifiedName() + ": " + tagName + " (value: " + tagText + ")" );
/** * Loads a Method object from the JavaDoc description of that method * * @param methodDoc the method in javadoc * @return the method if it can be loaded */ public static Option<Method> loadMethod(MethodDoc methodDoc) { ClassDoc classDoc = methodDoc.containingClass(); Option<Method> method = none(); Option<Class<?>[]> parameters = loadParameterClasses(methodDoc); Option<Class<?>> clz = loadClass(classDoc.qualifiedName()); if (clz.isDefined() && parameters.isDefined()) { method = matchMethod(methodDoc.name(), clz.get(), parameters.get()); } if (method.isEmpty()) { log.error(String.format("Unable to load methodDoc %s", methodDoc.qualifiedName())); } return method; }
public MethodSchemaInfo parseResponses(ParseContext parseCtx, MethodDoc methodDoc) { MethodSchemaInfo methodSchemaInfo = MethodSchemaInfo.info(methodDoc.qualifiedName()); Option<Method> methodOpt = ReflectionKit.loadMethod(methodDoc); if (methodOpt.isDefined()) { // // we don't yet have support for the swagger annotation Operation say which indicates what http status code // to use. But we could. However but most code is using Atlassian annotations for this. // Method method = methodOpt.get(); MethodSchemaInfo atlassianMethodSchemaInfo = schemaParserAtlassian.parseResponses(methodDoc, method); for (Map.Entry<HttpStatusCode, SchemaDefinition> entry : atlassianMethodSchemaInfo.getResponseSchemas().entrySet()) { SchemaDefinition schemaDefinition = entry.getValue(); Content content = readAsContent(parseCtx, schemaDefinition.getReturnType()); schemaDefinition = schemaDefinition.withContent(content); methodSchemaInfo = methodSchemaInfo.withSchemaDef(schemaDefinition.getHttpStatusCode(), schemaDefinition); } } return methodSchemaInfo; }
private static void addRequestRepresentationDoc(MethodDoc methodDoc, final MethodDocType methodDocType, Collection<String> expand, List<Module> modules) { final Tag requestElement = getSingleTagOrNull( methodDoc, "request.representation.qname" ); final Tag requestExample = getSingleTagOrNull( methodDoc, "request.representation.example" ); if ( requestElement != null || requestExample != null ) { final RequestDocType requestDoc = new RequestDocType(); final RepresentationDocType representationDoc = new RepresentationDocType(); /* requestElement exists */ if ( requestElement != null ) { representationDoc.setElement( QName.valueOf( requestElement.text() ) ); } /* requestExample exists */ if ( requestExample != null ) { final String example = getSerializedExample( requestExample, expand, modules); if ( !isEmpty( example ) ) { representationDoc.setExample( example ); } else { LOG.warning( "Could not get serialized example for method " + methodDoc.qualifiedName() ); } } requestDoc.setRepresentationDoc( representationDoc ); methodDocType.setRequestDoc( requestDoc ); } }
trace.trace(classDoc.name() + " > " + methodDoc.qualifiedName() + " > " + annotationDesc.annotationType().name()); trace.trace(asList(annotationDesc.elementValues()).toString()); trace.trace(methodDoc.commentText());
methodNode.setQualified(methodDoc.qualifiedName()); String comment = methodDoc.commentText(); if (comment.length() > 0) { methodNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, methodDoc.qualifiedName()));
String operationId = methodDoc.qualifiedName() + "_" + httpMethod.name().toLowerCase(); operation.setOperationId(operationId);