com.atlassian.jira.issue.comparator
Class UserCachingComparator

java.lang.Object
  extended by com.atlassian.jira.issue.comparator.UserCachingComparator
All Implemented Interfaces:
Comparator<com.atlassian.crowd.embedded.api.User>

@NotThreadSafe
public class UserCachingComparator
extends Object
implements Comparator<com.atlassian.crowd.embedded.api.User>

This comparator tries to compare two users based on their 'best name' ie their full name if possible, otherwise their username.

This class is NOT thread safe.

This comparator completely ignores case. This uses the user's locale to make sure that we correctly sort i18n characters.

WARNING: You should not reuse instances of this class beyond the scope of a servlet/rest/web request.

This class uses locale sensitive collation which is very expensive in cpu time. To minimise the overhead of this it caches the collation keys for users internally. Refer to http://docs.oracle.com/javase/tutorial/i18n/text/perform.html.

Since:
v6.2

Constructor Summary
UserCachingComparator()
           
UserCachingComparator(Locale locale)
           
 
Method Summary
 int compare(com.atlassian.crowd.embedded.api.User user1, com.atlassian.crowd.embedded.api.User user2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

UserCachingComparator

public UserCachingComparator(Locale locale)

UserCachingComparator

public UserCachingComparator()
Method Detail

compare

public int compare(com.atlassian.crowd.embedded.api.User user1,
                   com.atlassian.crowd.embedded.api.User user2)
Specified by:
compare in interface Comparator<com.atlassian.crowd.embedded.api.User>


Copyright © 2002-2014 Atlassian. All Rights Reserved.