Package com.sun.javadoc

Examples of com.sun.javadoc.MethodDoc


      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;
   }
View Full Code Here


   public boolean evaluate(DocSpecification docSpecification)
   {
    try
    {
     ClassDoc classDoc = docSpecification.getClassDoc();
     MethodDoc methodDoc = docSpecification.getMethodDoc();
     JCClassDecl classImplementation = docSpecification.getClassImplementation();
     JavaFileParser parser = docSpecification.getParser();
    
     String methodName = methodDoc.name();
     Parameter[] parameters = methodDoc.parameters();
     String[] parameterClassnames = new String[parameters.length];
     for (int i = 0;i< parameters.length; i++)
       parameterClassnames[i] = parameters[i].typeName();
    
     //handle only methods that are defined in the source code and not generated by the compiler.
     if ( !(
           methodDoc.isAbstract() ||
           methodDoc.isSynthetic() ||
           (classDoc.isEnum() && "values".equals(methodName) ) ||
           (classDoc.enumConstants() != null && (classDoc.enumConstants().length > 0) && "values".equals(methodName) )
         ))
     {
       /*
        System.out.println("class modifiers "+ classDoc.modifiers());
        System.out.println("class "+ classDoc.name()+" is enum:"  + classDoc.isEnum());
        System.out.println("enum constants " + classDoc.enumConstants());
        if (classDoc.enumConstants() != null)
          System.out.println("enum constants " + classDoc.enumConstants().length);
        System.out.println("method " + methodName + " is synthetic:"  + methodDoc.isSynthetic());
        */
        JCMethodDecl method = null;
        try
        {
          method = parser.getMethod(classImplementation, methodName, parameterClassnames);
        }
        catch (Exception ex)
        {
          ex.printStackTrace(); //there are currently some problems with enums so that excpetion can occur in the generated values method
        }
        if (method != null)
        {
           String methodBody = parser.getBodySourcecode(method);
          
           if ( (methodBody != null) &&  ! docSpecification.hasTag(methodDoc, "@"+ "return") && methodBody.contains("@return"))
           {
             methodDoc.setRawCommentText( methodDoc.getRawCommentText() + "\n" + GLUEBOOSTER_PREFIX_TEXT + " return");
           }
          
           handleGlueboosterTags(methodDoc, methodBody);
          
        }
View Full Code Here

      id = getIdentifier(cdoc.containingPackage()) + "." + cdoc.name();
    } else if (doc instanceof ConstructorDoc) {
      ConstructorDoc cdoc = (ConstructorDoc) doc;
      id = getIdentifier(cdoc.containingClass()) + "." + cdoc.name();
    } else if (doc instanceof MethodDoc) {
      MethodDoc cdoc = (MethodDoc) doc;
      id = getIdentifier(cdoc.containingClass()) + "." + cdoc.name();
    } else if (doc instanceof FieldDoc) {
      FieldDoc cdoc = (FieldDoc) doc;
      id = getIdentifier(cdoc.containingClass()) + "." + cdoc.name();
    } else {
      id = "hash " + doc.hashCode();
    }
 
    return id;
View Full Code Here

             * Verify that the implementation of this method throws only
             * java.lang.Exception or its subclasses (fix bugid 4092486).
             * JRMP does not support remote methods throwing
             * java.lang.Throwable or other subclasses.
             */
            MethodDoc implMethod = findImplMethod(method);
            if (implMethod != null) {           // should not be null
                for (ClassDoc ex : implMethod.thrownExceptions()) {
                    if (!ex.subclassOf(env.docException())) {
                        env.error("rmic.must.only.throw.exception",
                                  implMethod.name() + implMethod.signature(),
                                  ex.qualifiedName());
                        errors = true;
                        continue nextMethod;
                    }
                }
View Full Code Here

                new DigestOutputStream(sink, md));

            out.writeInt(INTERFACE_HASH_STUB_VERSION);

            for (Method method : remoteMethods) {
                MethodDoc methodDoc = method.methodDoc();

                out.writeUTF(methodDoc.name());
                out.writeUTF(Util.methodDescriptorOf(methodDoc));
                                // descriptors already use binary names

                ClassDoc exceptions[] = methodDoc.thrownExceptions();
                Arrays.sort(exceptions, new ClassDocComparator());
                for (ClassDoc ex : exceptions) {
                    out.writeUTF(Util.binaryNameOf(ex));
                }
            }
View Full Code Here

      }
      cls.setAttribute("description", classDoc.commentText());

      MethodDoc[] methods = classDoc.methods();
      for (int j = 0; j < methods.length; j++) {
        MethodDoc method = methods[j];
        Element function = document.createElement("function");
        cls.appendChild(function);
        function.setAttribute("name", method.name());
        function.setAttribute("description", method.commentText());
        function.setAttribute("type", method.returnType().typeName());

        Parameter[] params = method.parameters();
        for (int k = 0; k < params.length; k++) {
          Parameter param = params[k];
          Element parameter = document.createElement("parameter");
          parameter.setAttribute("name", param.name());
          parameter.setAttribute("type", param.typeName());
          function.appendChild(parameter);
        }

        String name = method.name();
        String description = method.getRawCommentText();
      }
    }
    try {
      Transformer transformer = TransformerFactory.newInstance().newTransformer();
      transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
View Full Code Here

      MethodDoc[] methodDocArray = classDoc.methods();

      for (int i = 0; i < methodDocArray.length; i++)
      {
         MethodDoc method = methodDocArray[i];

         if (method.tags(EVENT_TAG).length > 0 || method.tags(ATTRIBUTE_TAG).length > 0)
         {
            return true;
         }
      }
View Full Code Here

            if (overridingMethod.overrides(method))
              // skip it we've already done it
              continue METHODS;
          }
        }
        MethodDoc declaringMethod = Utils.findAnnotatedMethod(declaringClass, method, Path.class, GET.class, PUT.class, DELETE.class,
                                                              HEAD.class, POST.class);
        if (declaringMethod != null) {
          methods.add(new ResourceMethod(method, declaringMethod, this));
          // ok we've handled it
          if (overridingMethods == null) {
View Full Code Here

    // printSees();
    close("dl");
  }

  private void printIncludes() {
    MethodDoc javaDoc = method.getJavaDoc();
    Tag[] includes = Utils.getTags(javaDoc, "include");
    if (includes == null)
      return;
    File relativeTo = javaDoc.containingClass().position().file().getParentFile();
    for (Tag include : includes) {
      String fileName = include.text();
      File file = new File(relativeTo, fileName);
      if (!file.exists()) {
        doclet.printError(include.position(), "Missing included file: " + fileName);
View Full Code Here

   * configuration.tagletManager.getCustomTags(javaDoc), writer
   * .getTagletWriterInstance(false), output, tagletsSet);
   * writer.print(output.toString()); }
   */
  private void printTaglets(String tagletName) {
    MethodDoc javaDoc = method.getJavaDoc();
    TagletOutputImpl output = new TagletOutputImpl("");
    Set<String> tagletsSet = new HashSet<String>();
    tagletsSet.add(tagletName);
    Utils.genTagOuput(configuration.parentConfiguration.tagletManager, javaDoc,
                      configuration.parentConfiguration.tagletManager.getCustomTags(javaDoc), writer.getTagletWriterInstance(false),
View Full Code Here

TOP

Related Classes of com.sun.javadoc.MethodDoc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.