1 package org.andromda.utils.beans.comparators;
2
3 import java.io.Serializable;
4 import java.text.Collator;
5 import java.util.Comparator;
6
7
8
9
10
11
12 class StringComparator
13 implements Comparator,
14 Serializable
15 {
16 private static final long serialVersionUID = 34L;
17
18 private Collator collator = null;
19
20
21
22
23
24
25
26
27 public int compare(
28 final Object objectA,
29 final Object objectB)
30 {
31 this.initializeCollator();
32 return collator.compare(
33 objectA,
34 objectB);
35 }
36
37
38
39
40 private void initializeCollator()
41 {
42 if (this.collator == null)
43 {
44 this.collator = Collator.getInstance();
45
46
47 collator.setStrength(Collator.PRIMARY);
48 }
49 }
50 }