public class MessageList extends Object implements Serializable, Iterable<Message>
Messages.Message,
Serialized Form| Constructor and Description |
|---|
MessageList()
Creates an empty message list.
|
MessageList(Message message)
Creates a message list that contains the given message.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Message message)
Adds the message to the list.
|
void |
add(MessageList messageList)
Adds the messages in the given list to this list.
|
void |
add(MessageList messageList,
ObjectProperty invalidObjectProperty,
boolean override)
Copies the messages from the given list to this list and sets the message's invalid object
properties.
|
void |
clear()
Removes all of the messages from this list.
|
boolean |
containsErrorMsg()
Returns true if one the messages in the list is an error message, otherwise false.
|
static MessageList |
createCopy(MessageList list,
Object oldObject,
Object newObject)
Creates a copy from the message list and replaces all references to the old object with the
new object.
|
boolean |
equals(Object obj) |
Message |
getFirstMessage(Severity severity)
Returns the first message with the given severity or null if none is found.
|
Message |
getMessage(int index)
Returns the message at the indicated index (indexing starts with 0).
|
Message |
getMessageByCode(String code)
Returns the first message in the list that has the specified message code.
|
MessageList |
getMessagesByCode(String code)
Returns a new message list containing all the message in this list that have the specified
message code.
|
MessageList |
getMessagesByMarker(IMarker marker)
Returns a new message list containing all the message in this list that have the specified
IMarker. |
MessageList |
getMessagesByMarker(IPredicate<IMarker> markerPredicate)
Returns a new message list containing all the message in this list with a
IMarker the
specified IPredicate matches. |
MessageList |
getMessagesFor(Object object)
Returns a new list with the messages in this list that belong to the given object (any
property).
|
MessageList |
getMessagesFor(Object object,
String property)
Returns a new list with the messages in this list that belong to the given object and
property.
|
MessageList |
getMessagesFor(Object object,
String property,
int index)
Returns a new list with the messages in this list that belong to the given object and
property and the property is of the given index.
|
Message |
getMessageWithHighestSeverity()
Returns the message with the highest severity.
|
int |
getNoOfMessages()
Deprecated.
Use #size() instead
|
Severity |
getSeverity()
Returns the message list's severity.
|
String |
getText()
Returns the text of all messages in the list, separated by the system's default line
separator.
|
int |
hashCode() |
boolean |
isEmpty()
Returns true if the list is empty.
|
Iterator<Message> |
iterator()
Returns an iterator over the messages in this list.
|
int |
size()
Returns the number of messages in the list.
|
String |
toString()
Returns all messages in the list separated by a line separator.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic MessageList()
public MessageList(Message message)
NullPointerException - if message is null.public static final MessageList createCopy(MessageList list, Object oldObject, Object newObject)
list - the list to copyoldObject - the old object reference that should be replaced.newObject - the object reference to setpublic void add(Message message)
message - the Message to add. Ignored if null.public void add(MessageList messageList)
public void add(MessageList messageList, ObjectProperty invalidObjectProperty, boolean override)
messageList - the list to copy the messages from.invalidObjectProperty - the object and it's property that the messages refer to.override - true if the invalidObjectProperty should be set in all messages.
false if the invalidObjectProperty is set only for messages that do
not contain any invalid object property information.public boolean isEmpty()
@Deprecated public int getNoOfMessages()
public int size()
public Message getMessage(int index)
IndexOutOfBoundsException - if the index is out of range.public Message getFirstMessage(Severity severity)
public Message getMessageWithHighestSeverity()
isEmpty(), null is returned.public Message getMessageByCode(String code)
null if the list does not contain such a message.code - the code to look for. May be null, as messages may have
null as their message code.public MessageList getMessagesByCode(String code)
code - the code to look for. May be null, as messages may have
null as their message code.public MessageList getMessagesByMarker(IMarker marker)
public MessageList getMessagesByMarker(IPredicate<IMarker> markerPredicate)
IMarker the
specified IPredicate matches. Returns an empty list if this list does not contain any
such message.
Sample usage:
messages.getMessagesByMarker(new IPredicate<IMarker>(){public boolean test(IMarker t){return t.isRequiredInformationMissing();}});
Sample usage (Java8):
messages.getMessagesByMarker(IMarker::isRequiredInformationMissing);
markerPredicate - to match a IMarker with. Must not be nullNullPointerException - if markerPredicate is nullpublic Severity getSeverity()
public String getText()
public boolean containsErrorMsg()
public MessageList getMessagesFor(Object object)
public MessageList getMessagesFor(Object object, String property, int index)
public MessageList getMessagesFor(Object object, String property)
public void clear()
public String toString()
Copyright © 2018. All rights reserved.