I created a maven plugin and published it on github if anyone need it in the future:
https://github.com/himadri77/generate-default-impl-maven-plugin
Question
I am looking for a maven-plugin or just a library that can generate an empty implementation of an interface. Preferably I could pass an arbitrary interface:
public interface MyInterface {
void doSomethingNice();
long calculateSomething();
boolean isSomethingValid();
Object giveSomething();
}
And it would generate the following class:
public class MyInterfaceImpl implements MyInterface {
@Override public void doSomethingNice() {}
@Override public long calculateSomething() {return 0;}
@Override public boolean isSomethingValid() {return false;}
@Override public Object giveSomething() {return null;}
}
If such a maven-plugin existed, I would use it in generate-sources phase, to generate mocks and extend only those methods in which I need a specific mock-behavior. Anybody used something before?
Solution
I created a maven plugin and published it on github if anyone need it in the future:
https://github.com/himadri77/generate-default-impl-maven-plugin