Top Description Inners Fields Constructors Methods
org.aspectj.bridge

public Class CountingMessageHandler

extends Object
implements IMessageHandler
Class Inheritance
All Implemented Interfaces
org.aspectj.bridge.IMessageHandler
Imports
java.util.Enumeration, .Hashtable, org.aspectj.util.LangUtil

Wrap an IMessageHandler to count messages handled. Messages being ignored by the delegate IMessageHandler are not counted.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final Hashtable<IMessage.Kind, CountingMessageHandler.IntHolder>
public final IMessageHandler
public final CountingMessageHandler

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public boolean

Returns:

delegate.handleMessage(IMessage)
handleMessage
(IMessage
the IMessage to handle - never null
message
)

Implements org.aspectj.bridge.IMessageHandler.handleMessage.

Handle message, by reporting and/or throwing an AbortException.
public boolean

Returns:

true if 0 is less than numMessages(IMessage.ERROR, true)
hasErrors
()

public void
private void
public boolean

Returns:

delegate.isIgnoring(IMessage.Kind)
isIgnoring
(IMessage.Kind kind)

Implements org.aspectj.bridge.IMessageHandler.isIgnoring.

Signal clients whether this will ignore messages of a given type.
public static CountingMessageHandler
public int

Returns:

number of messages of this kind (optionally or greater)
numMessages
(IMessage.Kind
the IMessage.Kind of the messages to count (if null, count all)
kind
,
boolean
if true, then count this kind and any considered greater by the ordering of IMessage.Kind#COMPARATOR
orGreater
)

Return count of messages seen through this interface.

private int
public void
public String

Returns:

delegate.toString()
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

countersback to summary
private final Hashtable<IMessage.Kind, CountingMessageHandler.IntHolder> counters
delegateback to summary
public final IMessageHandler delegate
proxyback to summary
public final CountingMessageHandler proxy

Constructor Detail

CountingMessageHandlerback to summary
public CountingMessageHandler(IMessageHandler delegate)

Method Detail

dontIgnoreback to summary
public void dontIgnore(IMessage.Kind kind)

Implements org.aspectj.bridge.IMessageHandler.dontIgnore.

Delegate

See Also
org.aspectj.bridge.IMessageHandler#isIgnoring(org.aspectj.bridge.IMessage.Kind)
handleMessageback to summary
public boolean handleMessage(IMessage message) throws AbortException

Implements org.aspectj.bridge.IMessageHandler.handleMessage.

Doc from org.aspectj.bridge.IMessageHandler.handleMessage.

Handle message, by reporting and/or throwing an AbortException.

Parameters
message:IMessage

the IMessage to handle - never null

Returns:boolean

delegate.handleMessage(IMessage)

Exceptions
AbortException:
depending on handler logic.
hasErrorsback to summary
public boolean hasErrors()
Returns:boolean

true if 0 is less than numMessages(IMessage.ERROR, true)

ignoreback to summary
public void ignore(IMessage.Kind kind)

Implements org.aspectj.bridge.IMessageHandler.ignore.

Delegate

See Also
org.aspectj.bridge.IMessageHandler#ignore(org.aspectj.bridge.IMessage.Kind)
incrementback to summary
private void increment(IMessage.Kind kind)
isIgnoringback to summary
public boolean isIgnoring(IMessage.Kind kind)

Implements org.aspectj.bridge.IMessageHandler.isIgnoring.

Doc from org.aspectj.bridge.IMessageHandler.isIgnoring.

Signal clients whether this will ignore messages of a given type. Clients may use this to avoid constructing or sending certain messages.

Returns:boolean

delegate.isIgnoring(IMessage.Kind)

makeCountingMessageHandlerback to summary
public static CountingMessageHandler makeCountingMessageHandler(IMessageHandler handler)
numMessagesback to summary
public int numMessages(IMessage.Kind kind, boolean orGreater)

Return count of messages seen through this interface.

Parameters
kind:IMessage.Kind

the IMessage.Kind of the messages to count (if null, count all)

orGreater:boolean

if true, then count this kind and any considered greater by the ordering of IMessage.Kind#COMPARATOR

Returns:int

number of messages of this kind (optionally or greater)

See Also
IMessage.Kind#COMPARATOR
numMessagesback to summary
private int numMessages(IMessage.Kind kind)
resetback to summary
public void reset()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

delegate.toString()

org.aspectj.bridge back to summary

private Class CountingMessageHandler.IntHolder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

countback to summary
pack-priv int count

Constructor Detail

IntHolderback to summary
private IntHolder()