001package org.kuali.common.util.metainf.model;
002
003import java.util.Comparator;
004
005/**
006 * <p>
007 * Sort lexicographically by directory structure, then filename of the locations contained in each {@code MetaInfResource}
008 * </p>
009 * 
010 * For example:
011 * 
012 * <pre>
013 *   2 - /a/foo2.txt     1 - /a/foo1.txt
014 *   3 - /a/b/foo.txt    2 - /a/foo2.txt
015 *   1 - /a/foo1.txt     3 - /a/b/foo.txt
016 * </pre>
017 * 
018 */
019public class MetaInfResourcePathComparator implements Comparator<MetaInfResource> {
020
021        private final PathComparator comparator = new PathComparator();
022
023        @Override
024        public int compare(MetaInfResource one, MetaInfResource two) {
025                return comparator.compare(one.getLocation(), two.getLocation());
026        }
027}