Package it.tidalwave.actor
Class MessageSupport
- java.lang.Object
-
- it.tidalwave.actor.MessageSupport
-
- All Implemented Interfaces:
Collaboration.Provider
,As
,java.io.Serializable
- Direct Known Subclasses:
CollaborationCompletedMessage
,CollaborationStartedMessage
public abstract class MessageSupport extends java.lang.Object implements Collaboration.Provider, As, java.io.Serializable
A support class for implementing messages.- Author:
- Fabrizio Giudici
- See Also:
- Serialized Form
- Stereotype:
- Message
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface it.tidalwave.util.As
As.Defaults, As.NotFoundBehaviour<T>, As.Type<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected it.tidalwave.actor.impl.DefaultCollaboration
collaboration
-
Constructor Summary
Constructors Modifier Constructor Description protected
MessageSupport()
protected
MessageSupport(Collaboration collaboration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
as(java.lang.Class<T> type)
Returns an adapter to this object of the specified type.Collaboration
getCollaboration()
Returns theCollaboration
that this message is part of.Collaboration
send()
Sends this message, eventually performing a replacement (seeMessageDecorator
for further info).Collaboration
sendDirectly()
Sends this message directly, not performing any replacement (seeMessageDecorator
for further info).Collaboration
sendLater(int delay, java.util.concurrent.TimeUnit timeUnit)
Sends this message after a delay, eventually performing a replacement (seeMessageDecorator
for further info).
-
-
-
Constructor Detail
-
MessageSupport
protected MessageSupport()
-
MessageSupport
protected MessageSupport(@Nonnull Collaboration collaboration)
- Parameters:
collaboration
- the collaboration
-
-
Method Detail
-
getCollaboration
@Nonnull public Collaboration getCollaboration()
Returns theCollaboration
that this message is part of.- Specified by:
getCollaboration
in interfaceCollaboration.Provider
- Returns:
- the
Collaboration
-
send
@Nonnull public Collaboration send()
Sends this message, eventually performing a replacement (seeMessageDecorator
for further info).- Returns:
- the
Collaboration
that this message is part of
-
sendDirectly
@Nonnull public Collaboration sendDirectly()
Sends this message directly, not performing any replacement (seeMessageDecorator
for further info).- Returns:
- the
Collaboration
that this message is part of
-
sendLater
@Nonnull public Collaboration sendLater(@Nonnegative int delay, @Nonnull java.util.concurrent.TimeUnit timeUnit)
Sends this message after a delay, eventually performing a replacement (seeMessageDecorator
for further info).- Parameters:
delay
- the delaytimeUnit
- theTimeUnit
for the delay- Returns:
- the
Collaboration
that this message is part of
-
as
@Nonnull public <T> T as(@Nonnull java.lang.Class<T> type)
Returns an adapter to this object of the specified type. If the implementation can find multiple compliant adapters, only one will be returned.
-
-