public class MessageBuilder extends Object
This builder helps create modifiable messages conveniently.
Note that there is no possibility to set the sender of this message here. The sender is set by the Message Transport System in order to prevent abuse. In order to tell receivers to send replies to another agent use the reply-to field instead.
In Eclipse, you can register this class as a favorite ("Preferences" - "Java" - "Editor" - "Content Assist" - "Favorites"). Content assist will then propose the builder even if the import is missing.
ModifiableMessage
,
ReplyMessage
Modifier and Type | Method and Description |
---|---|
static MessageBuilder |
aMessage(CommunicativeAct performative)
Creates a builder for modifiable messages.
|
static MessageBuilder |
aReply(Message message,
CommunicativeAct performative)
Creates a builder for modifiable reply messages
|
ModifiableMessage |
build()
Builds the modifiable message defined by this builder.
|
MessageBuilder |
containing(String content)
Sets the string content of the messages to be built.
|
MessageBuilder |
containingObject(Serializable contentObject)
Sets the content object of the messages to be built.
|
MessageBuilder |
definedBy(OntologyIdentifier ontology)
Sets the ontology of the messages to be built.
|
MessageBuilder |
encodedAs(EncodingIdentifier encoding)
Sets the encoding of the messages to be built.
|
MessageBuilder |
inConversation(UniqueIdentifier conversationID)
Sets the conversation-id of the messages to be built.
|
MessageBuilder |
inLanguage(LanguageIdentifier language)
Sets the language of the messages to be built.
|
MessageBuilder |
inProtocol(ProtocolIdentifier protocol)
Sets the protocol of the messages to be built.
|
MessageBuilder |
inReplyTo(UniqueIdentifier inReplyTo)
Sets the in-reply-to of the messages to be built.
|
MessageBuilder |
replyBy(Timestamp replyBy)
Sets the reply-by of the messages to be built.
|
MessageBuilder |
replyTo(AgentIdentifier replyTo)
Adds a reply-to to the messages to be built.
|
MessageBuilder |
replyTo(SortedSet<AgentIdentifier> replyTos)
Adds a set of reply-tos to the messages to be built.
|
MessageBuilder |
replyWith(UniqueIdentifier replyWith)
Sets the reply-with of the messages to be built.
|
MessageBuilder |
to(AgentIdentifier receiver)
Adds a receiver to the messages to be built.
|
MessageBuilder |
to(SortedSet<AgentIdentifier> receivers)
Adds a set of receivers to the messages to be built.
|
MessageBuilder |
withUserParameter(UserParameter parameter)
Adds a user-defined parameter without value for the messages to be built.
|
MessageBuilder |
withUserParameter(UserParameter parameter,
String value)
Adds a user-defined parameter for the messages to be built.
|
public static MessageBuilder aMessage(CommunicativeAct performative)
performative
- the performative of the modifiable messagespublic static MessageBuilder aReply(Message message, CommunicativeAct performative)
message
- the original message to be repliedperformative
- the performative of the repliespublic MessageBuilder to(AgentIdentifier receiver)
receiver
- a receiver of the messages to be builtModifiableMessage.addReceiver(AgentIdentifier)
public MessageBuilder to(SortedSet<AgentIdentifier> receivers)
receivers
- a set of receivers of the messages to be builtModifiableMessage.addReceiver(AgentIdentifier)
public MessageBuilder replyTo(AgentIdentifier replyTo)
replyTo
- reply-to of the messages to be builtModifiableMessage.addReplyTo(AgentIdentifier)
public MessageBuilder replyTo(SortedSet<AgentIdentifier> replyTos)
replyTos
- a set of reply-tos of the messages to be builtModifiableMessage.addReceiver(AgentIdentifier)
public MessageBuilder containing(String content)
content
- the string content of the messages to be builtModifiableMessage.setContent(String)
public MessageBuilder containingObject(Serializable contentObject) throws IOException
contentObject
- the content object of the messages to be builtIOException
ModifiableMessage.setContentObject(Serializable)
public MessageBuilder inLanguage(LanguageIdentifier language)
language
- the language of the messages to be builtModifiableMessage.setLanguage(LanguageIdentifier)
public MessageBuilder encodedAs(EncodingIdentifier encoding)
encoding
- the encoding of the messages to be builtModifiableMessage.setEncoding(EncodingIdentifier)
public MessageBuilder definedBy(OntologyIdentifier ontology)
ontology
- the ontology of the messages to be builtModifiableMessage.setOntology(OntologyIdentifier)
public MessageBuilder inProtocol(ProtocolIdentifier protocol)
protocol
- the protocol of the messages to be builtModifiableMessage.setProtocol(ProtocolIdentifier)
public MessageBuilder inConversation(UniqueIdentifier conversationID)
conversationID
- the conversation-id of the messages to be builtModifiableMessage.setConversationID(UniqueIdentifier)
public MessageBuilder replyWith(UniqueIdentifier replyWith)
replyWith
- the reply-with of the messages to be builtModifiableMessage.setReplyWith(UniqueIdentifier)
public MessageBuilder inReplyTo(UniqueIdentifier inReplyTo)
inReplyTo
- the in-reply-to of the messages to be builtModifiableMessage.setInReplyTo(UniqueIdentifier)
public MessageBuilder replyBy(Timestamp replyBy)
replyBy
- the reply-by of the messages to be builtModifiableMessage.setReplyBy(Timestamp)
public MessageBuilder withUserParameter(UserParameter parameter)
parameter
- the user-defined parameter for the messages to be builtModifiableMessage.addUserParameter(UserParameter)
public MessageBuilder withUserParameter(UserParameter parameter, String value)
parameter
- the user-defined parameter for the messages to be builtvalue
- the value of the user-defined parameter for the messages to be
builtModifiableMessage.addUserParameter(UserParameter, String)
public ModifiableMessage build()
Copyright © Aimpulse Intelligent Systems GmbH
All rights reserved.