Package org.aspectj.bridge
Klasse MessageHandler
java.lang.Object
org.aspectj.bridge.MessageHandler
- Alle implementierten Schnittstellen:
IMessageHandler
,IMessageHolder
- Bekannte direkte Unterklassen:
WeavingAdaptor.WeavingAdaptorMessageHolder
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.
- Autor:
- PARC, Andy Clement
-
Feldübersicht
Modifizierer und TypFeldBeschreibungprotected boolean
result of handleMessage(..) for messages not accumulated (ignored)protected final List
<IMessage.Kind> kinds of messages to be ignoredprotected IMessageHandler
listener which can halt processing by returning truemessages accumulatedVon Schnittstelle geerbte Felder org.aspectj.bridge.IMessageHandler
SYSTEM_ERR, SYSTEM_OUT, THROW
Von Schnittstelle geerbte Felder org.aspectj.bridge.IMessageHolder
EQUAL, ORGREATER
-
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
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[]
IMessage[]
getMessages
(IMessage.Kind kind, boolean orGreater) Get all messages or those of a specific kind.IMessage[]
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 onvoid
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.toString()
-
Felddetails
-
messages
messages accumulated -
ignoring
kinds of messages to be ignored -
handleMessageResult
protected boolean handleMessageResultresult of handleMessage(..) for messages not accumulated (ignored) -
interceptor
listener which can halt processing by returning true
-
-
Konstruktordetails
-
MessageHandler
public MessageHandler()same as MessageHandler(false) -
MessageHandler
public MessageHandler(boolean accumulateOnly) - Parameter:
accumulateOnly
- the result of handleMessage (i.e., if true, then only accumulate messages - stop processing
-
-
Methodendetails
-
init
public void init()Initialize this, removing any messages accumulated, kinds being ignored, or interceptor. Assume that this should return false from handleMessage(..). -
init
public void init(boolean accumulateOnly) Initialize this, removing any messages accumulated, kinds being ignored, or interceptor.- Parameter:
accumulateOnly
- boolean value returned from handleMessage after accumulating in list
-
clearMessages
public void clearMessages()Clear the messages without changing other behavior.- Angegeben von:
clearMessages
in SchnittstelleIMessageHolder
-
handleMessage
This implementation accumulates message. If an interceptor is installed and returns true (message handled), then processing halts and the message is not accumulated.- Angegeben von:
handleMessage
in SchnittstelleIMessageHandler
- Parameter:
message
- the IMessage to handle - never null- Gibt zurück:
- true on interception or the constructor value otherwise
- Siehe auch:
-
isIgnoring
Beschreibung aus Schnittstelle kopiert:IMessageHandler
Signal clients whether this will ignore messages of a given type. Clients may use this to avoid constructing or sending certain messages.- Angegeben von:
isIgnoring
in SchnittstelleIMessageHandler
- Gibt zurück:
- true if this kind has been flagged to be ignored.
- Siehe auch:
-
ignore
Set a message kind to be ignored from now on- Angegeben von:
ignore
in SchnittstelleIMessageHandler
- Parameter:
kind
-
-
dontIgnore
Remove a message kind from the list of those ignored from now on.- Angegeben von:
dontIgnore
in SchnittstelleIMessageHandler
- Parameter:
kind
-
-
hasAnyMessage
Beschreibung aus Schnittstelle kopiert:IMessageHolder
Tell whether this holder has any message of this kind (optionally or greater).- Angegeben von:
hasAnyMessage
in SchnittstelleIMessageHolder
- Parameter:
kind
- 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- Gibt zurück:
- true if this holder has any message of this kind, or if orGreater and any message has a greater kind, as determined by IMessage.Kind.COMPARATOR
- Siehe auch:
-
numMessages
Beschreibung aus Schnittstelle kopiert:IMessageHolder
Count the messages currently held by this holder. Pass null to get all kinds.- Angegeben von:
numMessages
in SchnittstelleIMessageHolder
- Parameter:
kind
- the IMessage.Kind expected, or null for all messagesorGreater
- if true, also any greater than the target kind as determined by IMessage.Kind.COMPARATOR- Gibt zurück:
- number of messages accumulated of a given kind
-
getUnmodifiableListView
- Angegeben von:
getUnmodifiableListView
in SchnittstelleIMessageHolder
- Gibt zurück:
- unmodifiable List view of underlying collection of IMessage
- Siehe auch:
-
getMessages
Get all messages or those of a specific kind. Pass null to get all kinds.- Angegeben von:
getMessages
in SchnittstelleIMessageHolder
- Parameter:
kind
- 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- Gibt zurück:
- IMessage[] of messages of the right kind
-
getErrors
- Gibt zurück:
- array of error messages, or IMessage.NONE
-
getWarnings
- Gibt zurück:
- array of warning messages, or IMessage.NONE
-
setInterceptor
Set the interceptor which gets any message before we process it.- Parameter:
interceptor
- the IMessageHandler passed the message. Pass null to remove the old interceptor.
-
toString
-