Greetings,

I am encountering some difficulties with JaxMeJS.
After parsing an existing Java source file, I would like to modify the code
block, as well as, the comment block.
However,  when I attempt to access the methods or comments block it returns
null. I have included some code below:


    public void printPublicInstanceMethods(File pFile) throws Exception {
        JavaSourceFactory jsf = new JavaSourceFactory();
        JavaParser jp = new JavaParser(jsf);
         jp.parse(pFile);
         JavaSource js = jsf.getJavaSource(JavaQNameImpl.getInstance(
ServiceTemplate.class));
//         list fields
            JavaField[] f = js.getFields();
            System.out.println(f.length + " Fields found:");
            for (int i = 0; i < f.length; i++) {
                JavaField a = f[i];
                System.out.println(a.getProtection() + " " + a.getType() + "
"
    + a.getName() + ";");
            }
            JavaMethod[] methods = js.getMethods();
            for (int i = 0; i < methods.length; i++) {

                    System.out.println("  " + methods[i].getName());
                    System.out.println("  " + methods[i].getComment());
                    System.out.println("  " + methods[i].getLines(0));
                    System.out.println(methods[i].asString());
            }
}

thanks
regards
  • JaxMeJS Sajid Haniff

Reply via email to