Package project.gluebooster.objectanalysis

Examples of project.gluebooster.objectanalysis.JavaFileParser


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


            SourcePosition position = classDoc.position();
            if (position != null)
            {
               System.out.println("found file " + position.file());
               JavaFileParser parser = new JavaFileParser(position.file()
                     .getCanonicalPath());
               boostClassDoc(classDoc, parser.getClass(classDoc.name()), parser);
               parser.close();
            } else
               System.out.println("no file found");
         }
         return rootDoc;// @return
View Full Code Here

TOP

Related Classes of project.gluebooster.objectanalysis.JavaFileParser

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.