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.