Class MessageLists


  • public class MessageLists
    extends java.lang.Object
    Utility class for handling MessageList objects.
    • Method Detail

      • emptyMessageList

        public static final MessageList emptyMessageList()
        Returns a new empty MessageList.
        Returns:
        a new empty MessageList
      • orEmptyMessageList

        public static final MessageList orEmptyMessageList​(MessageList ml)
        Returns the given MessageList if it is not null or a new empty MessageList if it is.
        Parameters:
        ml - a MessageList, may be null
        Returns:
        the given MessageList if it is not null or a new empty MessageList if it is
      • sortBySeverity

        public static final MessageList sortBySeverity​(MessageList unsortedMessageList)
        Returns a new MessageList containing the same messages as the given list, sorted by descending Severity. Within each severity the previous order is preserved. Returns an empty MessageList if null is given.
        Parameters:
        unsortedMessageList - a MessageList that may be null
        Returns:
        a new MessageList containing the same messages as the given list, sorted by descending Severity
      • filtered

        public static final MessageList filtered​(MessageList ml,
                                                 java.util.function.Predicate<Message> predicate)
        Returns a new MessageList that contains all messages from the given list that satisfy the given predicate. Returns an empty MessageList if null is given.
        Parameters:
        ml - a MessageList that may be null
        predicate - a predicate to filter messages with
        Returns:
        a new MessageList all messages from the given list that satisfy the given predicate
      • flatten

        public static final java.util.stream.Collector<MessageList,​?,​MessageList> flatten()
        Returns a Collector that can be used to collect a Stream of MessageLists into a new MessageList.
        Returns:
        a Collector that collects MessageLists into a new MessageList
      • collectMessages

        public static final java.util.stream.Collector<Message,​?,​MessageList> collectMessages()
        Returns a Collector that can be used to collect messages from a Stream of Messages into a MessageList.
        Returns:
        a Collector that collects messages into a MessageList
      • join

        public static final MessageList join​(MessageList... messageLists)
        Returns a new MessageList that combines the messages of the given MessageLists including duplicates. Returns an empty MessageList if null is given.
        Parameters:
        messageLists - the MessageLists that the new MessageList will join. May be null
        Returns:
        a new MessageList that contains all messages of the given MessageLists