Java generic builder
问题 Suppose I need some DerivedBuilder to extend some BaseBuilder . Base builder has some method like foo (which returns BaseBuilder ). Derived builder has method bar . Method bar should be invoked after method foo . In order to do it I can override foo method in DerivedBuilder like this: @Override public DerivedBuilder foo() { super.foo(); return this; } The problem is that BaseBuilder has a lot of methods like foo and I have to override each one of them. I don't want to do that so I tried to