public class MessageHandler extends java.lang.Object implements IMessageHolder
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
handleMessageResult
result of handleMessage(..) for messages not accumulated (ignored)
|
protected java.util.ArrayList<IMessage.Kind> |
ignoring
kinds of messages to be ignored
|
protected IMessageHandler |
interceptor
listener which can halt processing by returning true
|
protected java.util.ArrayList<IMessage> |
messages
messages accumulated
|
EQUAL, ORGREATERSYSTEM_ERR, SYSTEM_OUT, THROW| Constructor and Description |
|---|
MessageHandler()
same as MessageHandler(false)
|
MessageHandler(boolean accumulateOnly) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearMessages()
Clear the messages without changing other behavior.
|
void |
dontIgnore(IMessage.Kind kind)
Remove a message kind from the list of those ignored from now on.
|
IMessage[] |
getErrors() |
IMessage[] |
getMessages(IMessage.Kind kind,
boolean orGreater)
Get all messages or those of a specific kind.
|
java.util.List<IMessage> |
getUnmodifiableListView() |
IMessage[] |
getWarnings() |
boolean |
handleMessage(IMessage message)
This implementation accumulates message.
|
boolean |
hasAnyMessage(IMessage.Kind kind,
boolean orGreater)
Tell whether this holder has any message of this kind (optionally or greater).
|
void |
ignore(IMessage.Kind kind)
Set a message kind to be ignored from now on
|
void |
init()
Initialize this, removing any messages accumulated, kinds being ignored, or interceptor.
|
void |
init(boolean accumulateOnly)
Initialize this, removing any messages accumulated, kinds being ignored, or interceptor.
|
boolean |
isIgnoring(IMessage.Kind kind)
Signal clients whether this will ignore messages of a given type.
|
int |
numMessages(IMessage.Kind kind,
boolean orGreater)
Count the messages currently held by this holder.
|
void |
setInterceptor(IMessageHandler interceptor)
Set the interceptor which gets any message before we process it.
|
java.lang.String |
toString() |
protected final java.util.ArrayList<IMessage> messages
protected final java.util.ArrayList<IMessage.Kind> ignoring
protected boolean handleMessageResult
protected IMessageHandler interceptor
public MessageHandler()
public MessageHandler(boolean accumulateOnly)
accumulateOnly - the result of handleMessage (i.e., if true, then only accumulate messages - stop processingpublic void init()
public void init(boolean accumulateOnly)
accumulateOnly - boolean value returned from handleMessage after accumulating in listpublic void clearMessages()
clearMessages in interface IMessageHolderpublic boolean handleMessage(IMessage message)
handleMessage in interface IMessageHandlermessage - the IMessage to handle - never nullIMessageHandler.handleMessage(IMessage)public boolean isIgnoring(IMessage.Kind kind)
IMessageHandlerisIgnoring in interface IMessageHandlerignore(IMessage.Kind),
org.aspectj.bridge.IMessageHandler#isIgnoring(Kind)public void ignore(IMessage.Kind kind)
ignore in interface IMessageHandlerpublic void dontIgnore(IMessage.Kind kind)
dontIgnore in interface IMessageHandlerpublic boolean hasAnyMessage(IMessage.Kind kind, boolean orGreater)
IMessageHolderhasAnyMessage in interface IMessageHolderkind - the IMessage.Kind to check for - accept any if nullorGreater - if true, also any greater than the target kind as determined by IMessage.Kind.COMPARATORorg.aspectj.bridge.IMessageHolder#hasAnyMessage(Kind, boolean)public int numMessages(IMessage.Kind kind, boolean orGreater)
IMessageHoldernumMessages in interface IMessageHolderkind - the IMessage.Kind expected, or null for all messagesorGreater - if true, also any greater than the target kind as determined by IMessage.Kind.COMPARATORpublic java.util.List<IMessage> getUnmodifiableListView()
getUnmodifiableListView in interface IMessageHolderIMessageHolder.getUnmodifiableListView()public IMessage[] getMessages(IMessage.Kind kind, boolean orGreater)
getMessages in interface IMessageHolderkind - the IMessage.Kind expected, or null for all messagesorGreater - if true, also get any greater than the target kind as determined by IMessage.Kind.COMPARATORpublic IMessage[] getErrors()
public IMessage[] getWarnings()
public void setInterceptor(IMessageHandler interceptor)
interceptor - the IMessageHandler passed the message. Pass null to remove the old interceptor.public java.lang.String toString()
toString in class java.lang.Object