Class CountingMessageHandler
java.lang.Object
org.aspectj.bridge.CountingMessageHandler
- All Implemented Interfaces:
IMessageHandler
Wrap an IMessageHandler to count messages handled. Messages being ignored by the delegate IMessageHandler are not counted.
-
Field Summary
FieldsFields inherited from interface IMessageHandler
SYSTEM_ERR, SYSTEM_OUT, THROWModifier and TypeFieldDescriptionstatic final IMessageHandlerprint all to System.err and throw AbortException on failure or abort messagesstatic final IMessageHandlerprint all to System.out but do not throw AbortException on failure or abort messagesstatic final IMessageHandlerThrow exceptions for anything with ERROR or greater severity -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddontIgnore(IMessage.Kind kind) DelegatebooleanhandleMessage(IMessage message) Handle message, by reporting and/or throwing an AbortException.booleanvoidignore(IMessage.Kind kind) DelegatebooleanisIgnoring(IMessage.Kind kind) Signal clients whether this will ignore messages of a given type.static CountingMessageHandlerintnumMessages(IMessage.Kind kind, boolean orGreater) Return count of messages seen through this interface.voidreset()toString()
-
Field Details
-
delegate
-
proxy
-
-
Constructor Details
-
CountingMessageHandler
-
-
Method Details
-
makeCountingMessageHandler
-
handleMessage
Description copied from interface:IMessageHandlerHandle message, by reporting and/or throwing an AbortException.- Specified by:
handleMessagein interfaceIMessageHandler- Parameters:
message- the IMessage to handle - never null- Returns:
- delegate.handleMessage(IMessage)
- Throws:
AbortException- depending on handler logic.
-
isIgnoring
Description copied from interface:IMessageHandlerSignal clients whether this will ignore messages of a given type. Clients may use this to avoid constructing or sending certain messages.- Specified by:
isIgnoringin interfaceIMessageHandler- Returns:
- delegate.isIgnoring(IMessage.Kind)
-
dontIgnore
Delegate- Specified by:
dontIgnorein interfaceIMessageHandler- Parameters:
kind-- See Also:
-
ignore
Delegate- Specified by:
ignorein interfaceIMessageHandler- Parameters:
kind-- See Also:
-
toString
-
numMessages
Return count of messages seen through this interface.- Parameters:
kind- the IMessage.Kind of the messages to count (if null, count all)orGreater- if true, then count this kind and any considered greater by the ordering of IMessage.Kind#COMPARATOR- Returns:
- number of messages of this kind (optionally or greater)
- See Also:
-
hasErrors
public boolean hasErrors()- Returns:
- true if 0 is less than
numMessages(IMessage.ERROR, true)
-
reset
public void reset()
-