提交 a7274d19 编写于 作者: K Kohsuke Kawaguchi

better type-safety

上级 cdfdb177
......@@ -56,7 +56,7 @@ import java.util.Map;
*
* @author Kohsuke Kawaguchi
*/
public class MatrixConfiguration extends Project<MatrixConfiguration,MatrixRun> implements SCMedItem, NonBlockingTask, Comparable {
public class MatrixConfiguration extends Project<MatrixConfiguration,MatrixRun> implements SCMedItem, NonBlockingTask, Comparable<MatrixConfiguration> {
/**
* The actual value combination.
*/
......@@ -289,20 +289,18 @@ public class MatrixConfiguration extends Project<MatrixConfiguration,MatrixRun>
public void setLogRotator(LogRotator logRotator) {
throw new UnsupportedOperationException();
}
public int compareTo(Object object){
MatrixConfigurationSorter sorter = getParent().getSorter();
try{
if(sorter!=null){
return getParent().getSorter().compare(this, (MatrixConfiguration)object);
}
else{
return getDisplayName().compareTo(((MatrixConfiguration)object).getDisplayName());
}
}
catch(Exception e){
throw new IllegalArgumentException(e);
public int compareTo(MatrixConfiguration that) {
MatrixConfigurationSorter sorter = getParent().getSorter();
try {
if (sorter != null) {
return getParent().getSorter().compare(this, that);
} else {
return getDisplayName().compareTo(((MatrixConfiguration) that).getDisplayName());
}
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册