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
-
-
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 Collaboration
getCollaboration()
Returns theCollaboration
that this message is part of.<T> java.util.Optional<T>
maybeAs(java.lang.Class<? extends T> type)
Returns the requested role or an emptyOptional
.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
-
-