Java Code Examples for com.sun.javadoc.ClassDoc#methods()
The following examples show how to use
com.sun.javadoc.ClassDoc#methods() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwaggerMoreDoclet.java From swagger-more with Apache License 2.0 | 6 votes |
private static void parseAndAnnotate(RootDoc rootDoc) throws ClassNotFoundException, NotFoundException, CannotCompileException, IOException { for (ClassDoc classDoc : rootDoc.classes()) { if (StringUtils.isEmpty(classDoc.getRawCommentText())) { DocLogger.warn("No javadoc found in class " + classDoc.qualifiedName() + "." + classDoc.name()); } Class clazz = Class.forName(classDoc.qualifiedName()); ClassPool pool = ClassPool.getDefault(); pool.insertClassPath(new ClassClassPath(clazz)); CtClass ctClass = pool.get(clazz.getName()); ApiInfo apiInfo = ApiInfo.fromClassDoc(clazz, classDoc); if (!apiInfo.hidden()) { annotateClassAnn(ctClass, apiInfo); for (MethodDoc methodDoc : classDoc.methods()) { ApiMethodInfo apiMethodInfo = ApiMethodInfo.fromMethodDoc(matchingMethod(clazz, methodDoc), methodDoc); if (StringUtils.isEmpty(methodDoc.getRawCommentText())) { DocLogger.warn("No javadoc found in method " + classDoc.qualifiedName() + "." + methodDoc.name() + methodDoc.signature()); } annotateMethodAnn(ctClass, apiMethodInfo); } DocLogger.info("Successfully annotated " + clazz.getTypeName()); } ctClass.writeFile(classDir); } }
Example 2
Source File: PSItemDoc.java From PrivacyStreams with Apache License 2.0 | 6 votes |
private PSItemDoc(ClassDoc classDoc) { this.classDoc = classDoc; this.name = classDoc.name(); this.description = classDoc.commentText(); this.itemFieldDocs = new ArrayList<>(); this.providerDocs = new ArrayList<>(); List<FieldDoc> allFields = new ArrayList<>(); this.getAllFieldDocs(classDoc, allFields); for (FieldDoc fieldDoc : allFields) { PSItemFieldDoc itemFieldDoc = PSItemFieldDoc.build(this, fieldDoc); if (itemFieldDoc != null) this.itemFieldDocs.add(itemFieldDoc); } for (MethodDoc methodDoc : classDoc.methods()) { PSOperatorDoc providerDoc = PSOperatorDoc.build(classDoc, methodDoc); if (providerDoc != null) this.providerDocs.add(providerDoc); } }
Example 3
Source File: AntTaskDoclet.java From ant-git-tasks with Apache License 2.0 | 6 votes |
private static void registerClassData(ClassDoc doc) { ClassData data = new ClassData(); Scanner sc = new Scanner(doc.commentText()); data.description = sc.nextLine(); sc.close(); data.qualifiedName = doc.qualifiedTypeName(); data.simpleName = doc.name(); data.hidden = doc.isAbstract(); data.parentClassDatas.addAll(collectParentClassesNames(doc)); for (MethodDoc methodDoc : doc.methods()) { if (!isHiddenMethodDoc(methodDoc)) { if (isTaskAttribute(methodDoc)) { data.attributesList.add(AttributeData.fromMethodDoc(methodDoc)); } else if (isTaskElement(methodDoc)) { data.elementsList.add(ElementData.fromMethodDoc(methodDoc)); } } } classDataMap.put(data.qualifiedName, data); }
Example 4
Source File: PSOperatorWrapperDoc.java From PrivacyStreams with Apache License 2.0 | 5 votes |
private PSOperatorWrapperDoc(ClassDoc classDoc) { this.classDoc = classDoc; this.name = classDoc.name(); this.description = classDoc.commentText(); this.operatorDocs = new ArrayList<>(); for (MethodDoc methodDoc : classDoc.methods()) { PSOperatorDoc operatorDoc = PSOperatorDoc.build(classDoc, methodDoc); if (operatorDoc != null) this.operatorDocs.add(operatorDoc); } }
Example 5
Source File: PSDoclet.java From PrivacyStreams with Apache License 2.0 | 5 votes |
private boolean build(RootDoc rootDoc) { this.readOptions(rootDoc.options()); ClassDoc[] classes = rootDoc.classes(); for (int i = 0; i < classes.length; ++i) { ClassDoc classDoc = classes[i]; PSItemDoc itemDoc = PSItemDoc.build(classDoc); if (itemDoc != null) this.psItems.add(itemDoc); PSOperatorWrapperDoc operatorWrapperDoc = PSOperatorWrapperDoc.build(classDoc); if (operatorWrapperDoc != null) this.psOperatorWrappers.add(operatorWrapperDoc); if (Utils.instanceOf(classDoc, Consts.TYPE_P_STREAM)) { for (MethodDoc methodDoc : classDoc.methods()) { PSPipelineDoc pipelineDoc = PSPipelineDoc.build(classDoc, methodDoc); if (pipelineDoc != null) { this.psPipelines.add(pipelineDoc); } } } } this.dump(); return true; }
Example 6
Source File: ClassDocumentation.java From spring-auto-restdocs with Apache License 2.0 | 5 votes |
public static ClassDocumentation fromClassDoc(ClassDoc classDoc) { ClassDocumentation cd = new ClassDocumentation(); cd.setComment(classDoc.commentText()); for (FieldDoc fieldDoc : classDoc.fields(false)) { cd.addField(fieldDoc); } for (MethodDoc methodDoc : classDoc.methods(false)) { cd.addMethod(methodDoc); } return cd; }
Example 7
Source File: DumpJavaDoc.java From cxf with Apache License 2.0 | 5 votes |
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; }
Example 8
Source File: Parser.java From xml-doclet with Apache License 2.0 | 5 votes |
protected Interface parseInterface(ClassDoc classDoc) { Interface interfaceNode = objectFactory.createInterface(); interfaceNode.setName(classDoc.name()); interfaceNode.setQualified(classDoc.qualifiedName()); String comment = classDoc.commentText(); if (comment.length() > 0) { interfaceNode.setComment(comment); } interfaceNode.setIncluded(classDoc.isIncluded()); interfaceNode.setScope(parseScope(classDoc)); for (TypeVariable typeVariable : classDoc.typeParameters()) { interfaceNode.getGeneric().add(parseTypeParameter(typeVariable)); } for (Type interfaceType : classDoc.interfaceTypes()) { interfaceNode.getInterface().add(parseTypeInfo(interfaceType)); } for (MethodDoc method : classDoc.methods()) { interfaceNode.getMethod().add(parseMethod(method)); } for (AnnotationDesc annotationDesc : classDoc.annotations()) { interfaceNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, classDoc.qualifiedName())); } for (Tag tag : classDoc.tags()) { interfaceNode.getTag().add(parseTag(tag)); } for (FieldDoc field : classDoc.fields()) { interfaceNode.getField().add(parseField(field)); } return interfaceNode; }
Example 9
Source File: Parser.java From xml-doclet with Apache License 2.0 | 4 votes |
protected Class parseClass(ClassDoc classDoc) { Class classNode = objectFactory.createClass(); classNode.setName(classDoc.name()); classNode.setQualified(classDoc.qualifiedName()); String comment = classDoc.commentText(); if (comment.length() > 0) { classNode.setComment(comment); } classNode.setAbstract(classDoc.isAbstract()); classNode.setError(classDoc.isError()); classNode.setException(classDoc.isException()); classNode.setExternalizable(classDoc.isExternalizable()); classNode.setIncluded(classDoc.isIncluded()); classNode.setSerializable(classDoc.isSerializable()); classNode.setScope(parseScope(classDoc)); for (TypeVariable typeVariable : classDoc.typeParameters()) { classNode.getGeneric().add(parseTypeParameter(typeVariable)); } Type superClassType = classDoc.superclassType(); if (superClassType != null) { classNode.setClazz(parseTypeInfo(superClassType)); } for (Type interfaceType : classDoc.interfaceTypes()) { classNode.getInterface().add(parseTypeInfo(interfaceType)); } for (MethodDoc method : classDoc.methods()) { classNode.getMethod().add(parseMethod(method)); } for (AnnotationDesc annotationDesc : classDoc.annotations()) { classNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, classDoc.qualifiedName())); } for (ConstructorDoc constructor : classDoc.constructors()) { classNode.getConstructor().add(parseConstructor(constructor)); } for (FieldDoc field : classDoc.fields()) { classNode.getField().add(parseField(field)); } for (Tag tag : classDoc.tags()) { classNode.getTag().add(parseTag(tag)); } return classNode; }