1 18 package org.apache.activemq.util; 19 20 import javax.jms.Message ; 21 22 import java.util.Comparator ; 23 24 29 public abstract class MessageComparatorSupport implements Comparator { 30 31 public int compare(Object object1, Object object2) { 32 Message command1 = (Message ) object1; 33 Message command2 = (Message ) object2; 34 return compareMessages(command1, command2); 35 } 36 37 protected abstract int compareMessages(Message message1, Message message2); 38 39 protected int compareComparators(Comparable comparable, Comparable comparable2) { 40 if (comparable != null) { 41 return comparable.compareTo(comparable2); 42 } 43 else if (comparable2 != null) { 44 return comparable2.compareTo(comparable) * -1; 45 } 46 return 0; 47 } 48 49 } 50 | Popular Tags |