Search in sources :

Example 1 with MethodDoc

use of com.sun.javadoc.MethodDoc in project rest.li by linkedin.

the class RestLiDoclet method start.

/**
   * Entry point for Javadoc Doclet.
   *
   * @param root {@link RootDoc} passed in by Javadoc
   * @return is successful or not
   */
public static boolean start(RootDoc root) {
    final DocInfo docInfo = new DocInfo();
    for (ClassDoc classDoc : root.classes()) {
        docInfo.setClassDoc(classDoc.qualifiedName(), classDoc);
        for (MethodDoc methodDoc : classDoc.methods()) {
            docInfo.setMethodDoc(MethodIdentity.create(methodDoc), methodDoc);
        }
    }
    _currentDocLet = new RestLiDoclet(docInfo);
    return true;
}
Also used : MethodDoc(com.sun.javadoc.MethodDoc) ClassDoc(com.sun.javadoc.ClassDoc)

Example 2 with MethodDoc

use of com.sun.javadoc.MethodDoc in project zm-mailbox by Zimbra.

the class DocletApiListener method processClass.

private void processClass(ClassDoc classDoc) {
    ApiClassDocumentation doc = new ApiClassDocumentation();
    processClassTags(doc, classDoc.tags());
    for (FieldDoc fieldDoc : classDoc.fields()) {
        processFieldTags(doc, fieldDoc);
    }
    for (MethodDoc methodDoc : classDoc.methods()) {
        processMethodTags(doc, methodDoc);
    }
    if (doc.hasDocumentation()) {
        docMap.put(classDoc.toString(), doc);
    }
}
Also used : FieldDoc(com.sun.javadoc.FieldDoc) MethodDoc(com.sun.javadoc.MethodDoc) ApiClassDocumentation(com.zimbra.doc.soap.ApiClassDocumentation)

Example 3 with MethodDoc

use of com.sun.javadoc.MethodDoc in project jangaroo-tools by CoreMedia.

the class MethodDocImpl method overriddenMethod.

public MethodDoc overriddenMethod() {
    ClassDoc superClass = containingClass().superclass();
    while (superClass != null) {
        MethodDoc superMethodDoc = getSuperMethodDoc(superClass);
        if (superMethodDoc != null)
            return superMethodDoc;
        superClass = superClass.superclass();
    }
    return null;
}
Also used : MethodDoc(com.sun.javadoc.MethodDoc) ClassDoc(com.sun.javadoc.ClassDoc)

Example 4 with MethodDoc

use of com.sun.javadoc.MethodDoc in project RESTdoclet by IG-Group.

the class MethodBuilder method build.

/**
    * Populate a Method type
    * 
    * @param method type to populate
    * @param methodDoc method doc
    * @param baseUri controller base uri
    * @return populated type
    */
public Method build(Method method, final MethodDoc methodDoc, final String baseUri) {
    assert method != null;
    assert methodDoc != null;
    LOG.info("Initialising method: " + methodDoc);
    MethodDoc md = DocletUtils.findMethodDocumentation(methodDoc);
    initName(method, methodDoc);
    initRequestMethod(method, methodDoc);
    initProduces(method, methodDoc);
    initConsumes(method, methodDoc);
    initHeaders(method, methodDoc);
    initJavadoc(method, md);
    initRequestParams(method, methodDoc.parameters(), md.paramTags());
    initPathParams(method, methodDoc.parameters(), md.paramTags());
    initModelParams(method, methodDoc.parameters(), md.paramTags());
    initBodyParams(method, methodDoc.parameters(), md.paramTags());
    initRestParams(method, methodDoc, baseUri);
    initResponseParams(method, methodDoc);
    return method;
}
Also used : MethodDoc(com.sun.javadoc.MethodDoc)

Example 5 with MethodDoc

use of com.sun.javadoc.MethodDoc in project RESTdoclet by IG-Group.

the class DocletUtils method findMethodDocumentation.

public static MethodDoc findMethodDocumentation(final MethodDoc methodDoc) {
    // Look in parent class for javadoc
    if (methodDoc.commentText().contains("@inheritDoc")) {
        ClassDoc containingClass = methodDoc.containingClass();
        ClassDoc superClass = containingClass.superclass().asClassDoc();
        for (MethodDoc md : superClass.methods()) {
            if (md.name().equalsIgnoreCase(methodDoc.name()) && md.signature().equalsIgnoreCase(methodDoc.signature())) {
                return md;
            }
        }
        // Look in interfaces for javadoc
        for (ClassDoc cd : containingClass.interfaces()) {
            for (MethodDoc md : cd.methods()) {
                if (md.name().equalsIgnoreCase(methodDoc.name()) && md.signature().equalsIgnoreCase(methodDoc.signature())) {
                    return md;
                }
            }
        }
    }
    return methodDoc;
}
Also used : MethodDoc(com.sun.javadoc.MethodDoc) ClassDoc(com.sun.javadoc.ClassDoc)

Aggregations

MethodDoc (com.sun.javadoc.MethodDoc)17 ClassDoc (com.sun.javadoc.ClassDoc)8 Type (com.sun.javadoc.Type)3 FieldDoc (com.sun.javadoc.FieldDoc)2 FieldParameter (com.iggroup.oss.restdoclet.doclet.type.FieldParameter)1 FieldParameterBuilder (com.iggroup.oss.restdoclet.doclet.type.builder.FieldParameterBuilder)1 ParameterizedType (com.sun.javadoc.ParameterizedType)1 Tag (com.sun.javadoc.Tag)1 ApiClassDocumentation (com.zimbra.doc.soap.ApiClassDocumentation)1 BufferedOutputStream (java.io.BufferedOutputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 DataOutputStream (java.io.DataOutputStream)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 MalformedURLException (java.net.MalformedURLException)1 URLClassLoader (java.net.URLClassLoader)1 DigestOutputStream (java.security.DigestOutputStream)1 MessageDigest (java.security.MessageDigest)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1