Module io.helidon.media.multipart
Package io.helidon.media.multipart
Class WriteableBodyPart.Builder
- java.lang.Object
-
- io.helidon.media.multipart.WriteableBodyPart.Builder
-
- All Implemented Interfaces:
Builder<WriteableBodyPart>
,Supplier<WriteableBodyPart>
- Enclosing class:
- WriteableBodyPart
public static final class WriteableBodyPart.Builder extends Object implements Builder<WriteableBodyPart>
Builder class for creatingBodyPart
instances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WriteableBodyPart
build()
Build the instance from this builder.WriteableBodyPart.Builder
entity(Object entity)
Create a new body part backed by the specified entity.<T> WriteableBodyPart.Builder
entityStream(Flow.Publisher<T> stream, Class<T> type)
Create a new body part backed by the specified entity stream.WriteableBodyPart.Builder
filename(String fileName)
Filename which will be used inContentDisposition
.WriteableBodyPart.Builder
headers(WriteableBodyPartHeaders headers)
Set the headers for this part.WriteableBodyPart.Builder
headers(Supplier<WriteableBodyPartHeaders> supplier)
Set the headers for this part.WriteableBodyPart.Builder
headers(Map<String,List<String>> headers)
Set the headers for this part.WriteableBodyPart.Builder
name(String name)
Name which will be used inContentDisposition
.WriteableBodyPart.Builder
publisher(Flow.Publisher<DataChunk> publisher)
Create a new body part backed by the specified publisher.
-
-
-
Method Detail
-
entity
public WriteableBodyPart.Builder entity(Object entity)
Create a new body part backed by the specified entity.- Parameters:
entity
- entity for the body part content- Returns:
- this builder instance
-
entityStream
public <T> WriteableBodyPart.Builder entityStream(Flow.Publisher<T> stream, Class<T> type)
Create a new body part backed by the specified entity stream.- Type Parameters:
T
- stream item type- Parameters:
stream
- stream of entities for the body part contenttype
- actual representation of the entity type- Returns:
- this builder instance
-
publisher
public WriteableBodyPart.Builder publisher(Flow.Publisher<DataChunk> publisher)
Create a new body part backed by the specified publisher.- Parameters:
publisher
- publisher for the part content- Returns:
- this builder instance
-
headers
public WriteableBodyPart.Builder headers(WriteableBodyPartHeaders headers)
Set the headers for this part.- Parameters:
headers
- headers- Returns:
- this builder instance
-
headers
public WriteableBodyPart.Builder headers(Supplier<WriteableBodyPartHeaders> supplier)
Set the headers for this part.- Parameters:
supplier
- headers supplier- Returns:
- this builder instance
-
headers
public WriteableBodyPart.Builder headers(Map<String,List<String>> headers)
Set the headers for this part.- Parameters:
headers
- headers map- Returns:
- this builder instance
-
name
public WriteableBodyPart.Builder name(String name)
Name which will be used inContentDisposition
.
This value will be ignored if an actual instance ofWriteableBodyPartHeaders
is set.- Parameters:
name
- content disposition name parameter- Returns:
- this builder instance
-
filename
public WriteableBodyPart.Builder filename(String fileName)
Filename which will be used inContentDisposition
.
This value will be ignored if an actual instance ofWriteableBodyPartHeaders
is set.- Parameters:
fileName
- content disposition filename parameter- Returns:
- this builder instance
-
build
public WriteableBodyPart build()
Description copied from interface:Builder
Build the instance from this builder.- Specified by:
build
in interfaceBuilder<WriteableBodyPart>
- Returns:
- instance of the built type
-
-