public abstract static class Message.AbstractBuilder<R extends Message,B extends Message.AbstractBuilder<R,B>> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected ReadableByteChannel |
bodyChannel |
protected Map<String,List<String>> |
headerMap |
protected MessageVersion |
version |
| Constructor and Description |
|---|
AbstractBuilder(MessageVersion defaultVersion) |
| Modifier and Type | Method and Description |
|---|---|
B |
addHeader(String name,
String value)
Adds a header field.
|
B |
addHeaders(Map<String,List<String>> headers)
Appends header fields.
|
B |
body(MediaType contentType,
byte[] contentBytes)
Sets the message body.
|
B |
body(MediaType contentType,
ReadableByteChannel channel,
long length)
Sets the message body.
|
abstract R |
build()
Finishes building.
|
B |
setHeader(String name,
String value)
Sets a header field.
|
B |
version(MessageVersion version)
Sets the protocol version of this message or record.
|
protected MessageVersion version
protected ReadableByteChannel bodyChannel
public AbstractBuilder(MessageVersion defaultVersion)
public abstract R build()
public B addHeader(String name, String value)
public B addHeaders(Map<String,List<String>> headers)
public B setHeader(String name, String value)
value is null then
simply removes all existing headers with the given name.public B version(MessageVersion version)
public B body(MediaType contentType, byte[] contentBytes)
contentBytes.
The Content-Type header will be set to contentType unless it is null.public B body(MediaType contentType, ReadableByteChannel channel, long length)
length.
The Content-Type header will be set to contentType unless it is null.Copyright © 2022. All rights reserved.