On Monday, 31 March 2014 15:17:57 UTC-4, Christian Gruber wrote:
>
> On 31 Mar 2014, at 11:45, Tavian Barnes wrote: 
>
> > I was thinking the priorities would constitute an absolute ordering 
> > for the 
> > entries (i.e., duplicate priorities prohibited).  Then they have a 
> > unique 
> > ordering even split across modules. 
>
> Ah.  That could work, though I can see it being one of those features 
> that poor planning will clobber nastily.  But it's also an "expert" 
> feature in a way, so wise users will space out their priority key-space 
> so there is room to insert. 
>

I've implemented this in Sangria: 
https://github.com/tavianator/sangria/pull/1.

The trick I've used to allow new priorities anywhere is to use an array of 
integers as the priority, and sort them lexicographically.  So priority [0] 
comes before [1], but [0, 0] comes in between them if you need it to.

It might be informative to look at the 
tests<https://github.com/tavianator/sangria/blob/listbinder/sangria-listbinder/src/test/java/com/tavianator/sangria/listbinder/ListBinderTest.java>,
 
and/or the actual 
implementation<https://github.com/tavianator/sangria/blob/listbinder/sangria-listbinder/src/main/java/com/tavianator/sangria/listbinder/ListBinder.java>.
 
 It's implemented on top of Multibinder.

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/d/optout.

Reply via email to