Ordering Strings via Spring ?
Cantor, Scott
cantor.2 at osu.edu
Fri Mar 13 13:47:43 EDT 2015
On 3/13/15, 1:33 PM, "Tom Zeller" <tzeller at dragonacea.biz> wrote:
>Anyone have code or suggestions on how to order Strings in a custom
>way via Spring ?
>
>I ask because of IDP-624, which is a request to control the ordering
>of attributes displayed during attribute release consent.
>
>What I want is to implement Comparator<String> based on a Spring
><util:list />, where Strings not in the list default to alphabetical
>ordering, or maybe are appended.
It's a trickier problem than it seems when you first approach it, because you don't really want to enumerate everything, you just want to force some things to appear earlier than others, and often you don't want to impose absolute order, just relative order.
I guess at first blush this seems like a twist on the problem I had to fix in IDP-602 to preference one authentication constant over another, but not explicitly have to list them all.
I did it with a map, assigning weighting integers to particular values and using that to drive a custom Comparator (see net.shibboleth.idp.authn.principal.DefaultPrincipalDeterminationStrategy).
I don't know if that's the best way, my college algorithm classes are a long way in the rear view.
-- Scott
More information about the dev
mailing list