1 package org.kuali.common.util.file.model; 2 3 import java.util.List; 4 5 import org.kuali.common.util.Assert; 6 7 public class DuplicateArtifact implements Comparable<DuplicateArtifact> { 8 9 public DuplicateArtifact(String path, List<ArtifactForTesting> artifacts) { 10 Assert.noBlanks(path); 11 Assert.noNulls(artifacts); 12 this.path = path; 13 this.artifacts = artifacts; 14 } 15 16 private final String path; 17 private final List<ArtifactForTesting> artifacts; 18 19 @Override 20 public int compareTo(DuplicateArtifact other) { 21 int sizeComparison = Double.compare(artifacts.size(), other.getArtifacts().size()); 22 if (sizeComparison == 0) { 23 return path.compareTo(other.getPath()); 24 } else { 25 return sizeComparison; 26 } 27 } 28 29 public String getPath() { 30 return path; 31 } 32 33 public List<ArtifactForTesting> getArtifacts() { 34 return artifacts; 35 } 36 37 }