I think you should inject the validator and processor into the class that
contains computevalue. I also recommend looking at scala-guice. If you do
find another way, I would love to hear it or add it to scala-guice.
On Oct 5, 2012 10:53 AM, "Travis Stevens" <[email protected]> wrote:

> I have an idea to use Guice to inject objects into scala curried
> functions.  For example, suppose I have the method signature:
>
> def computeValue(x: String)(validator: Validator, processor: Processor):
>> Answer
>
>
> And Guice knows how to build the Validator
>
>>  binder.bind(classOf[Validator]).toInstance(new MyValidator())
>
>
> If I call computeValue("value") I am left with a scala object which is a
> Function2[Validator, Processor, Answer], meaning I do something like:
>
> injector: Injector = ....
>> val v = injector.getInstance(classOf[Validation])
>> va p = injectory.getInstance(classOf[Processor])
>> f2.apply(v,p)
>
>
> Is there a way that I can simplify this process and make it more generic
> by using the Function2 type signature in order to get the values and call
> f2.apply?
>
> thanks,
> -Trav
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-guice/-/XjWjv94WFGcJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to