dimanche 10 mai 2015

Parsing file .java for recognize String methods

I wonder if it is possible with some framework ( or some native library of java ) read a .java file as a string and return , always as a string , methods , properties , and so on. etc .

Example

public class TestStackOverflow {

    private String value;

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String manipulateValue(String b){
        String c = (this.value + b);
        this.value=c;
        return c;
    }
}
---------------------

I would like a method that will read the file TestStackOverflow.java I returned methods in String..

example

File stoF= new File("/StackOverflow.java");
...
FrameworkParseJavaFile fpjf = new FrameworkParseJavaFile(stoF);
System.out.println("Methods print: " + fpjf.getMethods().get(0));

... results

Methods print:  public String getValue() {
        return value;
    }

Thank you very much for every answer. Ale





Aucun commentaire:

Enregistrer un commentaire