1 package net.sf.clirr.core.internal; 2 3 import java.util.Comparator; 4 5 import net.sf.clirr.core.spi.Named; 6 7 /*** 8 * Compares {@link Named named entities} by their name. 9 * 10 * @author Simon Kitching 11 * @author lkuehne 12 */ 13 public final class NameComparator implements Comparator 14 { 15 public NameComparator() 16 { 17 } 18 19 public int compare(Object o1, Object o2) 20 { 21 Named f1 = (Named) o1; 22 Named f2 = (Named) o2; 23 24 final String name1 = f1.getName(); 25 final String name2 = f2.getName(); 26 27 return name1.compareTo(name2); 28 } 29 } 30