Package org.faktorips.runtime
Class MessageLists
- java.lang.Object
-
- org.faktorips.runtime.MessageLists
-
public class MessageLists extends java.lang.ObjectUtility class for handlingMessageListobjects.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.stream.Collector<Message,?,MessageList>collectMessages()Returns aCollectorthat can be used to collect messages from aStreamofMessagesinto aMessageList.static MessageListemptyMessageList()Returns a new emptyMessageList.static MessageListfiltered(MessageList ml, java.util.function.Predicate<Message> predicate)Returns a newMessageListthat contains all messages from the given list that satisfy the given predicate.static java.util.stream.Collector<MessageList,?,MessageList>flatten()static MessageListjoin(MessageList... messageLists)Returns a newMessageListthat combines the messages of the givenMessageListsincluding duplicates.static MessageListorEmptyMessageList(MessageList ml)Returns the givenMessageListif it is notnullor a new emptyMessageListif it is.static MessageListsortBySeverity(MessageList unsortedMessageList)Returns a newMessageListcontaining the same messages as the given list, sorted by descendingSeverity.
-
-
-
Method Detail
-
emptyMessageList
public static final MessageList emptyMessageList()
Returns a new emptyMessageList.- Returns:
- a new empty
MessageList
-
orEmptyMessageList
public static final MessageList orEmptyMessageList(MessageList ml)
Returns the givenMessageListif it is notnullor a new emptyMessageListif it is.- Parameters:
ml- aMessageList, may benull- Returns:
- the given
MessageListif it is notnullor a new emptyMessageListif it is
-
sortBySeverity
public static final MessageList sortBySeverity(MessageList unsortedMessageList)
Returns a newMessageListcontaining the same messages as the given list, sorted by descendingSeverity. Within each severity the previous order is preserved. Returns an emptyMessageListifnullis given.- Parameters:
unsortedMessageList- aMessageListthat may benull- Returns:
- a new
MessageListcontaining the same messages as the given list, sorted by descendingSeverity
-
filtered
public static final MessageList filtered(MessageList ml, java.util.function.Predicate<Message> predicate)
Returns a newMessageListthat contains all messages from the given list that satisfy the given predicate. Returns an emptyMessageListifnullis given.- Parameters:
ml- aMessageListthat may benullpredicate- a predicate to filter messages with- Returns:
- a new
MessageListall messages from the given list that satisfy the given predicate
-
flatten
public static final java.util.stream.Collector<MessageList,?,MessageList> flatten()
- Returns:
- a
Collectorthat collectsMessageListsinto a newMessageList
-
collectMessages
public static final java.util.stream.Collector<Message,?,MessageList> collectMessages()
Returns aCollectorthat can be used to collect messages from aStreamofMessagesinto aMessageList.- Returns:
- a
Collectorthat collects messages into aMessageList
-
join
public static final MessageList join(MessageList... messageLists)
Returns a newMessageListthat combines the messages of the givenMessageListsincluding duplicates. Returns an emptyMessageListifnullis given.- Parameters:
messageLists- theMessageListsthat the newMessageListwill join. May benull- Returns:
- a new
MessageListthat contains all messages of the givenMessageLists
-
-