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 CoverageInfo} objects by label
13: * (useful for capabilities output, for example)
14: * @author Andrea Aime - TOPP
15: */
16: public class CoverageInfoLabelComparator implements Comparator {
17:
18: public int compare(Object o1, Object o2) {
19: CoverageInfo c1 = (CoverageInfo) o1;
20: CoverageInfo c2 = (CoverageInfo) o2;
21:
22: // this will take care of null values as well
23: return new CompareToBuilder().append(c1.getLabel(),
24: c2.getLabel()).toComparison();
25: }
26:
27: }
|