muh6mm3d / jannocessor

Automatically exported from code.google.com/p/jannocessor
Other
3 stars 1 forks source link

[question] Can jannocessor do this kind of generation? #21

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The examples are all about using jannocessor to generate new classes, but I 
wonder if it can do this kind of work.

Original code:

    @MyBuilder
    public String show(String id) {
        Question question = Question.findById(id);
        render(question);
    }

With custom `MyBuilder` created by jannocessor, the generated code will be:

    @MyBuilder
    public String show(String id) {
        Question question = Question.findById(id);

        Map<String,Object> data = new HashMap<String,Object>();
        data.put("question", question);
        renderWithData(data);
    }

`MyBuilder` will read the source code of `show` method, and change part of it. 
Is it available?

Original issue reported on code.google.com by nowind...@gmail.com on 20 Nov 2012 at 2:59