|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.aspectj.bridge.MessageHandler
public class MessageHandler
This handler accumulates messages. To control messages accumulated, clients can ignore messages of a given kind, or install a listener/interceptor. The interceptor handles all messages (even null) first, and can halt further processing/accumlation by returning true. Clients can obtain messages accumulated using the get... methods. XXX this does not permit messages to be removed.
| Field Summary | |
|---|---|
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 |
| Fields inherited from interface org.aspectj.bridge.IMessageHolder |
|---|
EQUAL, ORGREATER |
| Fields inherited from interface org.aspectj.bridge.IMessageHandler |
|---|
SYSTEM_ERR, SYSTEM_OUT, THROW |
| Constructor Summary | |
|---|---|
MessageHandler()
same as MessageHandler(false) |
|
MessageHandler(boolean accumulateOnly)
|
|
| Method Summary | |
|---|---|
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()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final java.util.ArrayList<IMessage> messages
protected final java.util.ArrayList<IMessage.Kind> ignoring
protected boolean handleMessageResult
protected IMessageHandler interceptor
| Constructor Detail |
|---|
public MessageHandler()
public MessageHandler(boolean accumulateOnly)
accumulateOnly - the result of handleMessage (i.e., if true, then only accumulate messages - stop processing| Method Detail |
|---|
public 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 null
IMessageHandler.handleMessage(IMessage)public boolean isIgnoring(IMessage.Kind kind)
IMessageHandler
isIgnoring 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 IMessageHandler
public boolean hasAnyMessage(IMessage.Kind kind,
boolean orGreater)
IMessageHolder
hasAnyMessage 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.COMPARATOR
org.aspectj.bridge.IMessageHolder#hasAnyMessage(Kind, boolean)
public int numMessages(IMessage.Kind kind,
boolean orGreater)
IMessageHolder
numMessages 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.COMPARATOR
public 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.COMPARATOR
public 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
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||