Package org.sim0mq.message
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.
- Author:
- Alexander Verbraeck
-
Field Summary
Modifier and TypeFieldDescriptionprotected Object
the Simulation run ids can be provided in different types.protected Object
The unique message number is meant to confirm with a callback that the message has been received correctly.protected Object
Message type ids can be defined per type of simulation, and can be provided in different types.protected Object
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).protected Object
The sender id can be used to send back a message to the sender at some later time. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract Sim0MQMessage
build()
Build the object.final B
setMessageId
(Object newMessageId) protected final B
setMessageTypeId
(Object newMessageTypeId) final B
setReceiverId
(Object newReceiverId) final B
setSenderId
(Object newSenderId) final B
setSimulationRunId
(Object newFederationId)
-
Field Details
-
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
The sender id can be used to send back a message to the sender at some later time. -
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
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
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
- Parameters:
newFederationId
- set federationId- Returns:
- the original object for chaining
-
setSenderId
- Parameters:
newSenderId
- set senderId- Returns:
- the original object for chaining
-
setReceiverId
- Parameters:
newReceiverId
- set receiverId- Returns:
- the original object for chaining
-
setMessageTypeId
- Parameters:
newMessageTypeId
- set messageTypeId- Returns:
- the original object for chaining
-
setMessageId
- Parameters:
newMessageId
- set messageId- Returns:
- the original object for chaining
-
build
Build the object.- Returns:
- the message object from the builder.
- Throws:
Sim0MQException
- on unknown data typeNullPointerException
- when one of the parameters is null
-