You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@reef.apache.org by Dhruv Mahajan <dh...@gmail.com> on 2016/09/22 00:01:34 UTC

Best way of getting another instance of interface

Hi

I have a question. Suppose in my underlying context I have binded interface
to some class and used its instance. Now I create a task where I need this
interface instance as well as another  new instance of the interface binded
to some other implementation. One way of doing this is to serialize the
configuration and pass it to the task which in turn can use it to create
new instance. I am wondering is there is another way to do that?

Thanks
Dhruv

Re: Best way of getting another instance of interface

Posted by Markus Weimer <ma...@weimo.de>.
You could use named parameters for this. Otherwise, see REEF-31, for
one of our hardest and longest standing design challenges.

Markus

On Wed, Sep 21, 2016 at 5:01 PM, Dhruv Mahajan <dh...@gmail.com> wrote:
> Hi
>
> I have a question. Suppose in my underlying context I have binded interface
> to some class and used its instance. Now I create a task where I need this
> interface instance as well as another  new instance of the interface binded
> to some other implementation. One way of doing this is to serialize the
> configuration and pass it to the task which in turn can use it to create
> new instance. I am wondering is there is another way to do that?
>
> Thanks
> Dhruv