I have an interface, whose method could conveniently return the instance on which the method is called. For instance, a setter could return "this".
interface OriginWise<T> {
T setOrigin( Origin origin );
}
Is there some way to get an instance of T automatically from the class it's applied to, without passing it as shown below?
class MyBean implements OriginWise<MyBean> {
MyBean setOrigin( Origin o ){ ...; return this; }
}
Also, what's the progress with default implementations in interfaces (methods which only use other interface's methods; not the same as abstract class)?