/
ExternalMessageBuilder.java
74 lines (65 loc) · 2.47 KB
/
ExternalMessageBuilder.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* Copyright (c) 2017 Bosch Software Innovations GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/org/documents/epl-2.0/index.php
*
* Contributors:
* Bosch Software Innovations GmbH - initial contribution
*/
package org.eclipse.ditto.model.amqpbridge;
import java.nio.ByteBuffer;
import java.util.Map;
import javax.annotation.Nullable;
/**
* Builder for building instances of {@link ExternalMessage}.
*/
public interface ExternalMessageBuilder {
/**
* Adds the additional header identified by the passed {@code key} and {@code value} to this builder.
*
* @param key the header key
* @param value the header value
* @return this builder in order to enable method chaining
*/
ExternalMessageBuilder withAdditionalHeaders(String key, String value);
/**
* Adds the additional headers to this builder.
*
* @param additionalHeaders the additional headers to add
* @return this builder in order to enable method chaining
*/
ExternalMessageBuilder withAdditionalHeaders(Map<String, String> additionalHeaders);
/**
* Sets the passed {@code text} to the builder and also changing the
* {@link org.eclipse.ditto.model.amqpbridge.ExternalMessage.PayloadType PayloadType} to {@code TEXT}.
*
* @param text the text payload to set
* @return this builder in order to enable method chaining
*/
ExternalMessageBuilder withText(@Nullable String text);
/**
* Sets the passed {@code bytes} to the builder and also changing the
* {@link org.eclipse.ditto.model.amqpbridge.ExternalMessage.PayloadType PayloadType} to {@code BYTES}.
*
* @param bytes the bytes payload to set
* @return this builder in order to enable method chaining
*/
ExternalMessageBuilder withBytes(@Nullable byte[] bytes);
/**
* Sets the passed {@code bytes} to the builder and also changing the
* {@link org.eclipse.ditto.model.amqpbridge.ExternalMessage.PayloadType PayloadType} to {@code BYTES}.
*
* @param bytes the bytes payload to set
* @return this builder in order to enable method chaining
*/
ExternalMessageBuilder withBytes(@Nullable ByteBuffer bytes);
/**
* Builds the ExternalMessage.
*
* @return the build message
*/
ExternalMessage build();
}