01: /*
02: * WbLocale.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.util;
13:
14: import java.util.Locale;
15:
16: /**
17: *
18: * @author support@sql-workbench.net
19: */
20: public class WbLocale implements Comparable<WbLocale> {
21: private final Locale locale;
22:
23: public WbLocale(Locale l) {
24: this .locale = l;
25: }
26:
27: public Locale getLocale() {
28: return locale;
29: }
30:
31: public String toString() {
32: String lang = StringUtil.capitalize(locale
33: .getDisplayLanguage(locale));
34: return lang;
35: }
36:
37: public int compareTo(WbLocale other) {
38: return this .toString().compareTo(other.toString());
39: }
40:
41: public boolean equals(Object other) {
42: if (other == null)
43: return false;
44: if (other instanceof WbLocale) {
45: return this .locale.equals(((WbLocale) other).locale);
46: }
47: return false;
48: }
49:
50: public int hashCode() {
51: return locale.hashCode();
52: }
53: }
|