01: package net.sf.clirr.core.internal;
02:
03: import java.util.Comparator;
04:
05: import net.sf.clirr.core.spi.Named;
06:
07: /**
08: * Compares {@link Named named entities} by their name.
09: *
10: * @author Simon Kitching
11: * @author lkuehne
12: */
13: public final class NameComparator implements Comparator {
14: public NameComparator() {
15: }
16:
17: public int compare(Object o1, Object o2) {
18: Named f1 = (Named) o1;
19: Named f2 = (Named) o2;
20:
21: final String name1 = f1.getName();
22: final String name2 = f2.getName();
23:
24: return name1.compareTo(name2);
25: }
26: }
|