Interface MessageStream.Entry<M extends Message>

Type Parameters:
M - The type of Message contained in this MessageStream.Entry implementation.
All Superinterfaces:
Context
All Known Implementing Classes:
SimpleEntry
Enclosing interface:
MessageStream<M extends Message>

public static interface MessageStream.Entry<M extends Message> extends Context
A MessageStream-specific container of Message implementations.

May be implemented to support entries that contain several objects. As such, this interface may be regarded as a tuple.

Since:
5.0.0
Author:
Allard Buijze, Milan Savić, Mitchell Herrijgers, Steven van Beelen
  • Method Details

    • message

      M message()
      Returns the Message implementation contained by this Entry.
      Returns:
      The Message implementation contained by this Entry.
    • map

      <RM extends Message> MessageStream.Entry<RM> map(@Nonnull Function<M,RM> mapper)
      Maps the message() by running it through the given mapper. This adjusts the contained message() into a Message implementation of type RM.
      Type Parameters:
      RM - The declared type of Message resulting from the given mapper.
      Parameters:
      mapper - A Function mapping the message() of type M to a Message of type RM.
      Returns:
      The result of running the current message() through the given mapper.
    • withResource

      <T> MessageStream.Entry<M> withResource(@Nonnull Context.ResourceKey<T> key, @Nonnull T resource)
      Description copied from interface: Context
      Constructs a copy of this Context with an additional resource for given key.
      Specified by:
      withResource in interface Context
      Type Parameters:
      T - The type of resource registered under the given key.
      Parameters:
      key - The key under which to register the resource.
      resource - The resource to register.
      Returns:
      A copy of this Context with the added given resources under the given key to the copy.