Is there a way to autogenerate wrappers in Eclipse?

Viewed 5958

I have to create several proxies, to add, for example, logging. Something like that:

interface IMath {
    public int add(a, b);
}

class Math implements IMath {
    public int add(a, b) { return a + b; }
}

class MathWithLogs implements IMath {
    private IMath realMath;
    public int add(a, b) {
        Log.d("tag", "valueable info");
        return realMath.add(a, b);
    }
}

Everything is fine as long as these interfaces aren't 20 methods and I have to add something to just one.

My question is, is there a way to autogenerate wrapper classes with some plugin for eclipse?

Or maybe there is a way to do something with annotations to invoke methods from realMath unless stated otherwise (like @Override)?

3 Answers
Related