001package org.kuali.common.util.metainf.model;
002
003import java.util.Comparator;
004
005import org.kuali.common.util.LocationUtils;
006import org.springframework.core.io.Resource;
007
008/**
009 * Compare 2 MetaInfResource objects based on the filename portion of the location they contain.
010 */
011public class MetaInfResourceFilenameComparator implements Comparator<MetaInfResource> {
012
013        @Override
014        public int compare(MetaInfResource one, MetaInfResource two) {
015                Resource res1 = LocationUtils.getResource(one.getLocation());
016                Resource res2 = LocationUtils.getResource(two.getLocation());
017                String filename1 = res1.getFilename();
018                String filename2 = res2.getFilename();
019                return filename1.compareTo(filename2);
020        }
021
022}