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 comparator completely ignores case, using the specified locale to make sure that we correctly sort i18n characters. It 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. See http://docs.oracle.com/javase/tutorial/i18n/text/perform.html for more information about collation keys and their performance implications.

WARNING: This class is NOT thread safe and caches information potentially about all users. You should not reuse instances of this class beyond the scope of a single servlet/rest/web request.

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-2015 Atlassian. All Rights Reserved.