Class MessageTypeComparator

  • All Implemented Interfaces:
    java.util.Comparator<Message>

    public class MessageTypeComparator
    extends java.lang.Object
    implements java.util.Comparator<Message>
    A comparator imposing an ordering on Message objects by comparing their types.

    Note: this comparator imposes orderings that are inconsistent with equals. This is the case when neither of the messages has a valid type set.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Comparator<? super MessageType> typeCmp  
    • Constructor Summary

      Constructors 
      Constructor Description
      MessageTypeComparator​(java.util.Comparator<? super MessageType> typeComparator)
      Creates a new MessageTypeComparator object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(Message o1, Message o2)
      Compares its two arguments for order according to their types
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Field Detail

      • typeCmp

        protected java.util.Comparator<? super MessageType> typeCmp
    • Constructor Detail

      • MessageTypeComparator

        public MessageTypeComparator​(java.util.Comparator<? super MessageType> typeComparator)
        Creates a new MessageTypeComparator object.
        Parameters:
        typeComparator - the comparator applied to compare the message types.
        Throws:
        java.lang.NullPointerException - DOCUMENT-ME
    • Method Detail

      • compare

        public int compare​(Message o1,
                           Message o2)
        Compares its two arguments for order according to their types
        Specified by:
        compare in interface java.util.Comparator<Message>
        Returns:
        the result of the specified message type comparator. Undefined values are evaluated as > 0.