@NotThreadSafe public static final class ImmutableAttachment.Builder extends Object
ImmutableAttachment.
Initialize attributes and then invoke the build() method to create an
immutable instance.
Builder is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
| Modifier and Type | Method and Description |
|---|---|
ImmutableAttachment |
build()
Builds a new
ImmutableAttachment. |
ImmutableAttachment.Builder |
contentType(String contentType)
Initializes the value for the
contentType attribute. |
ImmutableAttachment.Builder |
from(Attachment instance)
Fill a builder with attribute values from the provided
Attachment instance. |
ImmutableAttachment.Builder |
length(Long length)
Initializes the value for the
length attribute. |
ImmutableAttachment.Builder |
name(Optional<String> name)
Initializes the optional value
name to name. |
ImmutableAttachment.Builder |
name(String name)
Initializes the optional value
name to name. |
ImmutableAttachment.Builder |
octetStream(InputStream octetStream)
Initializes the value for the
octetStream attribute. |
public final ImmutableAttachment.Builder from(Attachment instance)
Attachment instance.
Regular attribute values will be replaced with those from the given instance.
Absent optional values will not replace present values.instance - The instance from which to copy valuesthis builder for use in a chained invocationpublic final ImmutableAttachment.Builder octetStream(InputStream octetStream)
octetStream attribute.octetStream - The value for octetStreamthis builder for use in a chained invocationpublic final ImmutableAttachment.Builder name(String name)
name to name.name - The value for namethis builder for chained invocationpublic final ImmutableAttachment.Builder name(Optional<String> name)
name to name.name - The value for namethis builder for use in a chained invocationpublic final ImmutableAttachment.Builder contentType(String contentType)
contentType attribute.contentType - The value for contentTypethis builder for use in a chained invocationpublic final ImmutableAttachment.Builder length(Long length)
length attribute.length - The value for lengththis builder for use in a chained invocationpublic ImmutableAttachment build()
ImmutableAttachment.IllegalStateException - if any required attributes are missingCopyright © 2023 iland Internet Solutions, Corp. All rights reserved.