Class MessageEvent

java.lang.Object
org.drasyl.node.event.MessageEvent
All Implemented Interfaces:
Event

public abstract class MessageEvent extends Object implements Event
This event signals that the node has received a message addressed to it.

This is an immutable object.

  • Constructor Details

    • MessageEvent

      public MessageEvent()
  • Method Details

    • getSender

      public abstract DrasylAddress getSender()
      Returns the message's sender.
      Returns:
      the message's sender
    • getPayload

      @Nullable public abstract Object getPayload()
      Returns the message's payload.
      Returns:
      the message's payload
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • of

      public static MessageEvent of(DrasylAddress sender, Object payload)
      Creates a new MessageEvent
      Parameters:
      sender - the message's sender
      payload - content of the message
      Throws:
      NullPointerException - if sender is null