Class GenericResetContext<T>

java.lang.Object
org.axonframework.messaging.MessageDecorator<T>
org.axonframework.eventhandling.replay.GenericResetContext<T>
Type Parameters:
T - the type of payload contained in the message
All Implemented Interfaces:
Serializable, ResetContext<T>, Message<T>

public class GenericResetContext<T> extends MessageDecorator<T> implements ResetContext<T>
Generic implementation of the ResetContext.
Since:
4.4
Author:
Steven van Beelen
See Also:
  • Constructor Details

    • GenericResetContext

      public GenericResetContext(T payload)
      Instantiate a GenericResetContext containing the given payload and en empty MetaData instance.
      Parameters:
      payload - the payload be included
    • GenericResetContext

      public GenericResetContext(T payload, Map<String,?> metaData)
      Instantiate a GenericResetContext containing the given payload and MetaData.
      Parameters:
      payload - the payload to be included
      metaData - the MetaData to be included
    • GenericResetContext

      public GenericResetContext(Message<T> message)
      Parameters:
      message -
  • Method Details

    • asResetContext

      public static <T> ResetContext<T> asResetContext(Object messageOrPayload)
      Returns the given messageOrPayload as a ResetContext. If messageOrPayload already implements ResetContext, it is returned as-is. If it implements Message, messageOrPayload will be cast to Message and current time is used to create a ResetContext. Otherwise, the given messageOrPayload is wrapped into a GenericResetContext as its payload.
      Type Parameters:
      T - the type of payload contained in the message
      Parameters:
      messageOrPayload - the payload to wrap or cast as ResetContext
      Returns:
      a ResetContext containing given messageOrPayload as payload, or the messageOrPayload if it already implements ResetContext.
    • withMetaData

      public GenericResetContext<T> withMetaData(@Nonnull Map<String,?> metaData)
      Description copied from interface: ResetContext
      Returns a copy of this ResetContext with the given metaData. The payload remains unchanged.

      While the implementation returned may be different than the implementation of this, implementations must take special care in returning the same type of Message (e.g. EventMessage, DomainEventMessage) to prevent errors further downstream.

      Specified by:
      withMetaData in interface Message<T>
      Specified by:
      withMetaData in interface ResetContext<T>
      Parameters:
      metaData - the new MetaData for the Message
      Returns:
      a copy of this message with the given MetaData
    • andMetaData

      public GenericResetContext<T> andMetaData(@Nonnull Map<String,?> additionalMetaData)
      Description copied from interface: ResetContext
      Returns a copy of this ResetContext with it MetaData merged with the given metaData. The payload remains unchanged.
      Specified by:
      andMetaData in interface Message<T>
      Specified by:
      andMetaData in interface ResetContext<T>
      Parameters:
      additionalMetaData - the MetaData to merge with
      Returns:
      a copy of this message with the given MetaData
    • describeType

      protected String describeType()
      Description copied from class: MessageDecorator
      Describe the type of message, used in MessageDecorator.toString().

      Defaults to the simple class name of the actual instance.

      Overrides:
      describeType in class MessageDecorator<T>
      Returns:
      the type of message