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 org.aspectj.bridge.IMessageHandler
SYSTEM_ERR, SYSTEM_OUT, THROW
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
dontIgnore
(IMessage.Kind kind) Delegateboolean
handleMessage
(IMessage message) Handle message, by reporting and/or throwing an AbortException.boolean
void
ignore
(IMessage.Kind kind) Delegateboolean
isIgnoring
(IMessage.Kind kind) Signal clients whether this will ignore messages of a given type.static CountingMessageHandler
int
numMessages
(IMessage.Kind kind, boolean orGreater) Return count of messages seen through this interface.void
reset()
toString()
-
Field Details
-
delegate
-
proxy
-
-
Constructor Details
-
CountingMessageHandler
-
-
Method Details
-
makeCountingMessageHandler
-
handleMessage
Description copied from interface:IMessageHandler
Handle message, by reporting and/or throwing an AbortException.- Specified by:
handleMessage
in interfaceIMessageHandler
- Parameters:
message
- the IMessage to handle - never null- Returns:
- delegate.handleMessage(IMessage)
- Throws:
AbortException
- depending on handler logic.
-
isIgnoring
Description copied from interface:IMessageHandler
Signal clients whether this will ignore messages of a given type. Clients may use this to avoid constructing or sending certain messages.- Specified by:
isIgnoring
in interfaceIMessageHandler
- Returns:
- delegate.isIgnoring(IMessage.Kind)
-
dontIgnore
Delegate- Specified by:
dontIgnore
in interfaceIMessageHandler
- Parameters:
kind
-- See Also:
-
ignore
Delegate- Specified by:
ignore
in 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()
-