public static final class MessageProperties.Builder
extends java.lang.Object
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
MessageProperties.Builder |
addValue(java.lang.String key,
java.lang.String value)
Add a new key/vale pair.
|
MessageProperties.Builder |
addValues(java.lang.String key,
java.util.List<java.lang.String> values)
Add a new key/values pair.
|
MessageProperties |
build()
Creates new instance of
MessageProperties using values from MessageProperties.Builder . |
MessageProperties.Builder |
copy(MessageProperties properties)
Copy another
MessageProperties by adding all properties to the current MessageProperties |
public final MessageProperties.Builder addValue(java.lang.String key, java.lang.String value)
null
. Key cannot be empty.
Key or value cannot be long strings. Maximum length for key is Message.Utils.MAX_KEY_LENGTH
bytes,
maximum length for value is Message.Utils.MAX_STRING_VALUE_LENGTH
bytes. The length is measured
after the string is encoded using UTF-8 encoding.key
- property keyvalue
- property valuejava.lang.NullPointerException
- for null
key or the values are null
.java.lang.IllegalArgumentException
- for empty or long key or for long value.public final MessageProperties.Builder addValues(java.lang.String key, java.util.List<java.lang.String> values)
null
. Key cannot be empty
or long string. Values cannot contain long strings. Maximum length for key is
Message.Utils.MAX_KEY_LENGTH
bytes, maximum length for any value is
Message.Utils.MAX_STRING_VALUE_LENGTH
bytes. The length is measured after the string is encoded
using UTF-8 encoding.key
- property keyvalues
- property valuesjava.lang.NullPointerException
- for null
key or if the values are null
or any item in values
is null
.java.lang.IllegalArgumentException
- for empty or long key and for any long item in values.public final MessageProperties.Builder copy(MessageProperties properties)
MessageProperties
by adding all properties to the current MessageProperties
properties
- MessageProperties
to copypublic final MessageProperties build()
MessageProperties
using values from MessageProperties.Builder
.MessageProperties