On Thu, Mar 18, 2010 at 12:19 AM, Fred Faber <[email protected]> wrote:

> I think you'd be better off using a MapBinder.  The boilerplate of guice
> essentially disappears, with only your specific configuration needing to
> consume a linearly incremental amount of code per new type.
>
> Code below.
>
> regards
> -Fred
>

The use case which inspired the post has more complicated logic used to
decide the concrete implementation, where various case clauses inspect
different properties of a data bean which is the sole parameter.  I was
trying to capture that with my contrived example (the 'inverted'), but
didn't think too much about it and missed the mark.

Thinking about it some more, ideally, a generic way to dynamically produce a
provider which binds functional tests to resultant types would eliminate the
entire boilerplate class!  It would be a neat extension to write.  Hmm...

(Speaking of which, I have another problem, which is the lack of canonical
"function" interfaces in Java, leading people to invent new ones each time
they need it.  In Scala, we have Function0<RT>, Function1<RT,P1T>,
Function2<RT,P1T,P2T> traits.  Is there any Java project which provides
these, plus perhaps the adapters for currying, functional composition,
adapting static methods and reflected Methods, etc?  It's simple enough to
write, but again, it would be nice if there were something more
"canonical".)

-- 
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