Class Sim0MQMessage.Builder<B extends Sim0MQMessage.Builder<B>>

java.lang.Object
org.sim0mq.message.Sim0MQMessage.Builder<B>
Type Parameters:
B - the actual inherited builder for the return types.
Direct Known Subclasses:
FM1StartFederateMessage.Builder, FM2SimRunControlMessage.Builder, FM3SetParameterMessage.Builder, FM4SimStartMessage.Builder, FM5RequestStatus.Builder, FM6RequestStatisticsMessage.Builder, FM7SimResetMessage.Builder, FM8KillFederateMessage.Builder, FM9KillAllMessage.Builder, FS1RequestStatusMessage.Builder, FS2FederateStartedMessage.Builder, FS3KillModelMessage.Builder, FS4FederateKilledMessage.Builder, FS5FederatesKilledMessage.Builder, HB1HeartbeatMessage.Builder, MC3StatisticsMessage.Builder, MC4StatisticsErrorMessage.Builder, Sim0MQReply.Builder
Enclosing class:
Sim0MQMessage

public abstract static class Sim0MQMessage.Builder<B extends Sim0MQMessage.Builder<B>> extends Object
Builder for the Sim0MQMessage. Can string setters together, and call build() at the end to build the actual message.

Copyright (c) 2016-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See Sim0MQ License.

$LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Apr 22, 2017
Author:
Alexander Verbraeck
  • Field Details

    • federationId

      protected Object federationId
      the Simulation run ids can be provided in different types. Examples are two 64-bit longs indicating a UUID, or a String with a UUID number, a String with meaningful identification, or a short or an int with a simulation run number.
    • senderId

      protected Object senderId
      The sender id can be used to send back a message to the sender at some later time.
    • receiverId

      protected Object receiverId
      The receiver id can be used to check whether the message is meant for us, or should be discarded (or an error can be sent if we receive a message not meant for us).
    • messageTypeId

      protected Object messageTypeId
      Message type ids can be defined per type of simulation, and can be provided in different types. Examples are a String with a meaningful identification, or a short or an int with a message type number.
    • messageId

      protected Object messageId
      The unique message number is meant to confirm with a callback that the message has been received correctly. The number is unique for the sender, so not globally within the federation.
  • Constructor Details

    • Builder

      public Builder()
      Empty constructor.
  • Method Details

    • setSimulationRunId

      public final B setSimulationRunId(Object newFederationId)
      Parameters:
      newFederationId - set federationId
      Returns:
      the original object for chaining
    • setSenderId

      public final B setSenderId(Object newSenderId)
      Parameters:
      newSenderId - set senderId
      Returns:
      the original object for chaining
    • setReceiverId

      public final B setReceiverId(Object newReceiverId)
      Parameters:
      newReceiverId - set receiverId
      Returns:
      the original object for chaining
    • setMessageTypeId

      protected final B setMessageTypeId(Object newMessageTypeId)
      Parameters:
      newMessageTypeId - set messageTypeId
      Returns:
      the original object for chaining
    • setMessageId

      public final B setMessageId(Object newMessageId)
      Parameters:
      newMessageId - set messageId
      Returns:
      the original object for chaining
    • build

      public abstract Sim0MQMessage build() throws Sim0MQException, NullPointerException
      Build the object.
      Returns:
      the message object from the builder.
      Throws:
      Sim0MQException - on unknown data type
      NullPointerException - when one of the parameters is null