com.sun.javadoc.MethodDoc Java Examples
The following examples show how to use
com.sun.javadoc.MethodDoc.
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: StubSkeletonWriter.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Writes code to initialize the static fields for each method * using the Java Reflection API. **/ private void writeMethodFieldInitializers(IndentingWriter p) throws IOException { for (int i = 0; i < methodFieldNames.length; i++) { p.p(methodFieldNames[i] + " = "); /* * Look up the Method object in the somewhat arbitrary * interface that we find in the Method object. */ RemoteClass.Method method = remoteMethods[i]; MethodDoc methodDoc = method.methodDoc(); String methodName = methodDoc.name(); Type paramTypes[] = method.parameterTypes(); p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" + methodName + "\", new java.lang.Class[] {"); for (int j = 0; j < paramTypes.length; j++) { if (j > 0) p.p(", "); p.p(paramTypes[j].toString() + ".class"); } p.pln("});"); } }
Example #2
Source File: SpecificationTaglet.java From kodkod with MIT License | 6 votes |
/** * {@inheritDoc} */ @Override public Content getTagletOutput(Doc doc, TagletWriter writer) throws IllegalArgumentException { Tag[] tags = doc.tags(getName()); if (tags.length==0 && doc instanceof MethodDoc) { // inherit if necessary and possible final DocFinder.Output inheritedDoc = DocFinder.search(new DocFinder.Input((MethodDoc) doc, this)); tags = inheritedDoc.holderTag == null ? tags : new Tag[] {inheritedDoc.holderTag}; } if (tags.length==0) return null; final StringBuilder out = writeHeader(new StringBuilder()); for(Tag tag : tags) { writeTag(out, tag, writer); } return new RawHtml(out.toString()); }
Example #3
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 #4
Source File: StubSkeletonWriter.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Writes code to initialize the static fields for each method * using the Java Reflection API. **/ private void writeMethodFieldInitializers(IndentingWriter p) throws IOException { for (int i = 0; i < methodFieldNames.length; i++) { p.p(methodFieldNames[i] + " = "); /* * Look up the Method object in the somewhat arbitrary * interface that we find in the Method object. */ RemoteClass.Method method = remoteMethods[i]; MethodDoc methodDoc = method.methodDoc(); String methodName = methodDoc.name(); Type paramTypes[] = method.parameterTypes(); p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" + methodName + "\", new java.lang.Class[] {"); for (int j = 0; j < paramTypes.length; j++) { if (j > 0) p.p(", "); p.p(paramTypes[j].toString() + ".class"); } p.pln("});"); } }
Example #5
Source File: StubSkeletonWriter.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Writes code to initialize the static fields for each method * using the Java Reflection API. **/ private void writeMethodFieldInitializers(IndentingWriter p) throws IOException { for (int i = 0; i < methodFieldNames.length; i++) { p.p(methodFieldNames[i] + " = "); /* * Look up the Method object in the somewhat arbitrary * interface that we find in the Method object. */ RemoteClass.Method method = remoteMethods[i]; MethodDoc methodDoc = method.methodDoc(); String methodName = methodDoc.name(); Type paramTypes[] = method.parameterTypes(); p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" + methodName + "\", new java.lang.Class[] {"); for (int j = 0; j < paramTypes.length; j++) { if (j > 0) p.p(", "); p.p(paramTypes[j].toString() + ".class"); } p.pln("});"); } }
Example #6
Source File: StubSkeletonWriter.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Writes code to initialize the static fields for each method * using the Java Reflection API. **/ private void writeMethodFieldInitializers(IndentingWriter p) throws IOException { for (int i = 0; i < methodFieldNames.length; i++) { p.p(methodFieldNames[i] + " = "); /* * Look up the Method object in the somewhat arbitrary * interface that we find in the Method object. */ RemoteClass.Method method = remoteMethods[i]; MethodDoc methodDoc = method.methodDoc(); String methodName = methodDoc.name(); Type paramTypes[] = method.parameterTypes(); p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" + methodName + "\", new java.lang.Class[] {"); for (int j = 0; j < paramTypes.length; j++) { if (j > 0) p.p(", "); p.p(paramTypes[j].toString() + ".class"); } p.pln("});"); } }
Example #7
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 #8
Source File: StubSkeletonWriter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Writes code to initialize the static fields for each method * using the Java Reflection API. **/ private void writeMethodFieldInitializers(IndentingWriter p) throws IOException { for (int i = 0; i < methodFieldNames.length; i++) { p.p(methodFieldNames[i] + " = "); /* * Look up the Method object in the somewhat arbitrary * interface that we find in the Method object. */ RemoteClass.Method method = remoteMethods[i]; MethodDoc methodDoc = method.methodDoc(); String methodName = methodDoc.name(); Type paramTypes[] = method.parameterTypes(); p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" + methodName + "\", new java.lang.Class[] {"); for (int j = 0; j < paramTypes.length; j++) { if (j > 0) p.p(", "); p.p(paramTypes[j].toString() + ".class"); } p.pln("});"); } }
Example #9
Source File: StubSkeletonWriter.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Writes code to initialize the static fields for each method * using the Java Reflection API. **/ private void writeMethodFieldInitializers(IndentingWriter p) throws IOException { for (int i = 0; i < methodFieldNames.length; i++) { p.p(methodFieldNames[i] + " = "); /* * Look up the Method object in the somewhat arbitrary * interface that we find in the Method object. */ RemoteClass.Method method = remoteMethods[i]; MethodDoc methodDoc = method.methodDoc(); String methodName = methodDoc.name(); Type paramTypes[] = method.parameterTypes(); p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" + methodName + "\", new java.lang.Class[] {"); for (int j = 0; j < paramTypes.length; j++) { if (j > 0) p.p(", "); p.p(paramTypes[j].toString() + ".class"); } p.pln("});"); } }
Example #10
Source File: StubSkeletonWriter.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Writes code to initialize the static fields for each method * using the Java Reflection API. **/ private void writeMethodFieldInitializers(IndentingWriter p) throws IOException { for (int i = 0; i < methodFieldNames.length; i++) { p.p(methodFieldNames[i] + " = "); /* * Look up the Method object in the somewhat arbitrary * interface that we find in the Method object. */ RemoteClass.Method method = remoteMethods[i]; MethodDoc methodDoc = method.methodDoc(); String methodName = methodDoc.name(); Type paramTypes[] = method.parameterTypes(); p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" + methodName + "\", new java.lang.Class[] {"); for (int j = 0; j < paramTypes.length; j++) { if (j > 0) p.p(", "); p.p(paramTypes[j].toString() + ".class"); } p.pln("});"); } }
Example #11
Source File: StubSkeletonWriter.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Writes code to initialize the static fields for each method * using the Java Reflection API. **/ private void writeMethodFieldInitializers(IndentingWriter p) throws IOException { for (int i = 0; i < methodFieldNames.length; i++) { p.p(methodFieldNames[i] + " = "); /* * Look up the Method object in the somewhat arbitrary * interface that we find in the Method object. */ RemoteClass.Method method = remoteMethods[i]; MethodDoc methodDoc = method.methodDoc(); String methodName = methodDoc.name(); Type paramTypes[] = method.parameterTypes(); p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" + methodName + "\", new java.lang.Class[] {"); for (int j = 0; j < paramTypes.length; j++) { if (j > 0) p.p(", "); p.p(paramTypes[j].toString() + ".class"); } p.pln("});"); } }
Example #12
Source File: RemoteClass.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Creates a new Method instance for the specified method. **/ Method(MethodDoc methodDoc) { this.methodDoc = methodDoc; exceptionTypes = methodDoc.thrownExceptions(); /* * Sort exception types to improve consistency with * previous implementations. */ Arrays.sort(exceptionTypes, new ClassDocComparator()); operationString = computeOperationString(); nameAndDescriptor = methodDoc.name() + Util.methodDescriptorOf(methodDoc); methodHash = computeMethodHash(); }
Example #13
Source File: RemoteClass.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Creates a new Method instance for the specified method. **/ Method(MethodDoc methodDoc) { this.methodDoc = methodDoc; exceptionTypes = methodDoc.thrownExceptions(); /* * Sort exception types to improve consistency with * previous implementations. */ Arrays.sort(exceptionTypes, new ClassDocComparator()); operationString = computeOperationString(); nameAndDescriptor = methodDoc.name() + Util.methodDescriptorOf(methodDoc); methodHash = computeMethodHash(); }
Example #14
Source File: RemoteClass.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Returns the MethodDoc for the method of this remote * implementation class that implements the specified remote * method of a remote interface. Returns null if no matching * method was found in this remote implementation class. **/ private MethodDoc findImplMethod(MethodDoc interfaceMethod) { String name = interfaceMethod.name(); String desc = Util.methodDescriptorOf(interfaceMethod); for (MethodDoc implMethod : implClass.methods()) { if (name.equals(implMethod.name()) && desc.equals(Util.methodDescriptorOf(implMethod))) { return implMethod; } } return null; }
Example #15
Source File: ProgrammaticWrappingProxyInstaller.java From sarl with Apache License 2.0 | 5 votes |
/** Wrap a method doc. * * @param source the source * @return the wrapper. */ public MethodDoc[] wrap(MethodDoc[] source) { if (source == null) { return null; } final List<MethodDoc> list = new ArrayList<>(); for (final MethodDoc element : source) { if (isIncluded(element)) { list.add(wrap(element)); } } return Utils.toArray(source, list); }
Example #16
Source File: Parser.java From xml-doclet with Apache License 2.0 | 5 votes |
protected Method parseMethod(MethodDoc methodDoc) { Method methodNode = objectFactory.createMethod(); methodNode.setName(methodDoc.name()); methodNode.setQualified(methodDoc.qualifiedName()); String comment = methodDoc.commentText(); if (comment.length() > 0) { methodNode.setComment(comment); } methodNode.setScope(parseScope(methodDoc)); methodNode.setAbstract(methodDoc.isAbstract()); methodNode.setIncluded(methodDoc.isIncluded()); methodNode.setFinal(methodDoc.isFinal()); methodNode.setNative(methodDoc.isNative()); methodNode.setStatic(methodDoc.isStatic()); methodNode.setSynchronized(methodDoc.isSynchronized()); methodNode.setVarArgs(methodDoc.isVarArgs()); methodNode.setSignature(methodDoc.signature()); methodNode.setReturn(parseTypeInfo(methodDoc.returnType())); for (Parameter parameter : methodDoc.parameters()) { methodNode.getParameter().add(parseMethodParameter(parameter)); } for (Type exceptionType : methodDoc.thrownExceptionTypes()) { methodNode.getException().add(parseTypeInfo(exceptionType)); } for (AnnotationDesc annotationDesc : methodDoc.annotations()) { methodNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, methodDoc.qualifiedName())); } for (Tag tag : methodDoc.tags()) { methodNode.getTag().add(parseTag(tag)); } return methodNode; }
Example #17
Source File: RemoteClass.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Returns the MethodDoc for the method of this remote * implementation class that implements the specified remote * method of a remote interface. Returns null if no matching * method was found in this remote implementation class. **/ private MethodDoc findImplMethod(MethodDoc interfaceMethod) { String name = interfaceMethod.name(); String desc = Util.methodDescriptorOf(interfaceMethod); for (MethodDoc implMethod : implClass.methods()) { if (name.equals(implMethod.name()) && desc.equals(Util.methodDescriptorOf(implMethod))) { return implMethod; } } return null; }
Example #18
Source File: Util.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Returns the method descriptor for the specified method. * * See section 4.3.3 of The Java Virtual Machine Specification * Second Edition for the definition of a "method descriptor". **/ static String methodDescriptorOf(MethodDoc method) { String desc = "("; Parameter[] parameters = method.parameters(); for (int i = 0; i < parameters.length; i++) { desc += typeDescriptorOf(parameters[i].type()); } desc += ")" + typeDescriptorOf(method.returnType()); return desc; }
Example #19
Source File: Util.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Returns a reader-friendly string representation of the * specified method's signature. Names of reference types are not * package-qualified. **/ static String getFriendlyUnqualifiedSignature(MethodDoc method) { String sig = method.name() + "("; Parameter[] parameters = method.parameters(); for (int i = 0; i < parameters.length; i++) { if (i > 0) { sig += ", "; } Type paramType = parameters[i].type(); sig += paramType.typeName() + paramType.dimension(); } sig += ")"; return sig; }
Example #20
Source File: Util.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Returns the method descriptor for the specified method. * * See section 4.3.3 of The Java Virtual Machine Specification * Second Edition for the definition of a "method descriptor". **/ static String methodDescriptorOf(MethodDoc method) { String desc = "("; Parameter[] parameters = method.parameters(); for (int i = 0; i < parameters.length; i++) { desc += typeDescriptorOf(parameters[i].type()); } desc += ")" + typeDescriptorOf(method.returnType()); return desc; }
Example #21
Source File: RemoteClass.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Creates a new Method instance for the specified method. **/ Method(MethodDoc methodDoc) { this.methodDoc = methodDoc; exceptionTypes = methodDoc.thrownExceptions(); /* * Sort exception types to improve consistency with * previous implementations. */ Arrays.sort(exceptionTypes, new ClassDocComparator()); operationString = computeOperationString(); nameAndDescriptor = methodDoc.name() + Util.methodDescriptorOf(methodDoc); methodHash = computeMethodHash(); }
Example #22
Source File: RemoteClass.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Creates a new Method instance for the specified method. **/ Method(MethodDoc methodDoc) { this.methodDoc = methodDoc; exceptionTypes = methodDoc.thrownExceptions(); /* * Sort exception types to improve consistency with * previous implementations. */ Arrays.sort(exceptionTypes, new ClassDocComparator()); operationString = computeOperationString(); nameAndDescriptor = methodDoc.name() + Util.methodDescriptorOf(methodDoc); methodHash = computeMethodHash(); }
Example #23
Source File: RemoteClass.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Returns the MethodDoc for the method of this remote * implementation class that implements the specified remote * method of a remote interface. Returns null if no matching * method was found in this remote implementation class. **/ private MethodDoc findImplMethod(MethodDoc interfaceMethod) { String name = interfaceMethod.name(); String desc = Util.methodDescriptorOf(interfaceMethod); for (MethodDoc implMethod : implClass.methods()) { if (name.equals(implMethod.name()) && desc.equals(Util.methodDescriptorOf(implMethod))) { return implMethod; } } return null; }
Example #24
Source File: SarlMethodWriter.java From sarl with Apache License 2.0 | 5 votes |
@Override protected void addReturnType(MethodDoc method, Content htmlTree) { htmlTree.addContent(this.writer.getSpace()); htmlTree.addContent(Utils.getKeywords().getColonKeyword()); htmlTree.addContent(" "); //$NON-NLS-1$ super.addReturnType(method, htmlTree); }
Example #25
Source File: Util.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Returns the method descriptor for the specified method. * * See section 4.3.3 of The Java Virtual Machine Specification * Second Edition for the definition of a "method descriptor". **/ static String methodDescriptorOf(MethodDoc method) { String desc = "("; Parameter[] parameters = method.parameters(); for (int i = 0; i < parameters.length; i++) { desc += typeDescriptorOf(parameters[i].type()); } desc += ")" + typeDescriptorOf(method.returnType()); return desc; }
Example #26
Source File: RemoteClass.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Creates a new Method instance for the specified method. **/ Method(MethodDoc methodDoc) { this.methodDoc = methodDoc; exceptionTypes = methodDoc.thrownExceptions(); /* * Sort exception types to improve consistency with * previous implementations. */ Arrays.sort(exceptionTypes, new ClassDocComparator()); operationString = computeOperationString(); nameAndDescriptor = methodDoc.name() + Util.methodDescriptorOf(methodDoc); methodHash = computeMethodHash(); }
Example #27
Source File: Util.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Returns the method descriptor for the specified method. * * See section 4.3.3 of The Java Virtual Machine Specification * Second Edition for the definition of a "method descriptor". **/ static String methodDescriptorOf(MethodDoc method) { String desc = "("; Parameter[] parameters = method.parameters(); for (int i = 0; i < parameters.length; i++) { desc += typeDescriptorOf(parameters[i].type()); } desc += ")" + typeDescriptorOf(method.returnType()); return desc; }
Example #28
Source File: Util.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Returns a reader-friendly string representation of the * specified method's signature. Names of reference types are not * package-qualified. **/ static String getFriendlyUnqualifiedSignature(MethodDoc method) { String sig = method.name() + "("; Parameter[] parameters = method.parameters(); for (int i = 0; i < parameters.length; i++) { if (i > 0) { sig += ", "; } Type paramType = parameters[i].type(); sig += paramType.typeName() + paramType.dimension(); } sig += ")"; return sig; }
Example #29
Source File: Util.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Returns a reader-friendly string representation of the * specified method's signature. Names of reference types are not * package-qualified. **/ static String getFriendlyUnqualifiedSignature(MethodDoc method) { String sig = method.name() + "("; Parameter[] parameters = method.parameters(); for (int i = 0; i < parameters.length; i++) { if (i > 0) { sig += ", "; } Type paramType = parameters[i].type(); sig += paramType.typeName() + paramType.dimension(); } sig += ")"; return sig; }
Example #30
Source File: RemoteClass.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Returns the MethodDoc for the method of this remote * implementation class that implements the specified remote * method of a remote interface. Returns null if no matching * method was found in this remote implementation class. **/ private MethodDoc findImplMethod(MethodDoc interfaceMethod) { String name = interfaceMethod.name(); String desc = Util.methodDescriptorOf(interfaceMethod); for (MethodDoc implMethod : implClass.methods()) { if (name.equals(implMethod.name()) && desc.equals(Util.methodDescriptorOf(implMethod))) { return implMethod; } } return null; }