org.meshcms.util
Class LocaleComparator

java.lang.Object
  extended byorg.meshcms.util.LocaleComparator
All Implemented Interfaces:
java.util.Comparator, java.io.Serializable

public class LocaleComparator
extends java.lang.Object
implements java.util.Comparator, java.io.Serializable

Compares locales to sort them according to their display name.

See Also:
Serialized Form

Constructor Summary
LocaleComparator()
          Creates a new instance using the system default locale to get display names.
LocaleComparator(java.util.Locale locale)
          Creates a new instance using the given locale to get display names.
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compares two locales.
 java.util.Locale getLocale()
          Returns the locale used to get the display names.
 void setLocale(java.util.Locale locale)
          Sets the locale used to get the display names, so one can sort the locales according to a specific language.
 
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

LocaleComparator

public LocaleComparator()
Creates a new instance using the system default locale to get display names.


LocaleComparator

public LocaleComparator(java.util.Locale locale)
Creates a new instance using the given locale to get display names.

Method Detail

setLocale

public void setLocale(java.util.Locale locale)
Sets the locale used to get the display names, so one can sort the locales according to a specific language.


getLocale

public java.util.Locale getLocale()
Returns the locale used to get the display names.


compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Compares two locales.

Specified by:
compare in interface java.util.Comparator