java - Redirect interface method calls -


i have interface1 , 2 implementations of it, classa , classb. want redirect method calls classa classb. i'm doing this:

class classa implements interface1{     method1(){        b.method1();     }     method2(){         b.method2();     }     method3(){         b.method3();     }     //and on... } 

is there more easy way this?

have considered using abstract class instead of interface? can put common implementations in abstract class, , in classa , classb implement methods 2 classes differ.

abstract class abstract {     void method1() {         //do stuff...     }     abstract void method2(); }  class classa extends abstract {     @override     void method2() {         // something...     } }  class classb extends abstract {     @override     void method2() {         // else...     } } 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -