Class MessageSupport

java.lang.Object
it.tidalwave.actor.MessageSupport
All Implemented Interfaces:
Collaboration.Provider, As, Serializable
Direct Known Subclasses:
CollaborationCompletedMessage, CollaborationStartedMessage

public abstract class MessageSupport extends Object implements Collaboration.Provider, As, Serializable
A support class for implementing messages.
Author:
Fabrizio Giudici
See Also:
Stereotype:
Message
  • Field Details

    • collaboration

      @Nonnull protected final it.tidalwave.actor.impl.DefaultCollaboration collaboration
  • Constructor Details

    • MessageSupport

      protected MessageSupport()
    • MessageSupport

      protected MessageSupport(@Nonnull Collaboration collaboration)
      Parameters:
      collaboration - the collaboration
  • Method Details

    • getCollaboration

      @Nonnull public Collaboration getCollaboration()
      Returns the Collaboration that this message is part of.
      Specified by:
      getCollaboration in interface Collaboration.Provider
      Returns:
      the Collaboration
    • send

      @Nonnull public Collaboration send()
      Sends this message, eventually performing a replacement (see MessageDecorator 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 (see MessageDecorator for further info).
      Returns:
      the Collaboration that this message is part of
    • sendLater

      @Nonnull public Collaboration sendLater(@Nonnegative int delay, @Nonnull TimeUnit timeUnit)
      Sends this message after a delay, eventually performing a replacement (see MessageDecorator for further info).
      Parameters:
      delay - the delay
      timeUnit - the TimeUnit for the delay
      Returns:
      the Collaboration that this message is part of
    • maybeAs

      @Nonnull public <T> Optional<T> maybeAs(@Nonnull Class<? extends T> type)
      Specified by:
      maybeAs in interface As