01: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
02: * This code is licensed under the GPL 2.0 license, availible at the root
03: * application directory.
04: */
05: package org.vfny.geoserver.global;
06:
07: import java.util.Comparator;
08:
09: import org.apache.commons.lang.builder.CompareToBuilder;
10:
11: /**
12: * A comparator used to sort {@link FeatureTypeInfo} objects by title
13: * (useful for capabilities output, for example)
14: * @author Andrea Aime - TOPP
15: */
16: public class FeatureTypeInfoTitleComparator implements Comparator {
17:
18: public int compare(Object o1, Object o2) {
19: FeatureTypeInfo ft1 = (FeatureTypeInfo) o1;
20: FeatureTypeInfo ft2 = (FeatureTypeInfo) o2;
21:
22: // this will take care of null values as well
23: return new CompareToBuilder().append(ft1.getTitle(),
24: ft2.getTitle()).toComparison();
25: }
26:
27: }
|