@NotThreadSafe public static final class SmtpSessionConfig.Builder extends Object
SmtpSessionConfig
.
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 |
---|---|
SmtpSessionConfig |
build()
Builds a new
SmtpSessionConfig . |
SmtpSessionConfig.Builder |
connectionId(String connectionId)
Initializes the value for the
connectionId attribute. |
SmtpSessionConfig.Builder |
connectionTimeout(Duration connectionTimeout)
Initializes the value for the
connectionTimeout attribute. |
SmtpSessionConfig.Builder |
disabledExtensions(EnumSet<Extension> disabledExtensions)
Initializes the value for the
disabledExtensions attribute. |
SmtpSessionConfig.Builder |
exceptionHandler(Consumer<Throwable> exceptionHandler)
Initializes the optional value
exceptionHandler to exceptionHandler. |
SmtpSessionConfig.Builder |
exceptionHandler(Optional<Consumer<Throwable>> exceptionHandler)
Initializes the optional value
exceptionHandler to exceptionHandler. |
SmtpSessionConfig.Builder |
from(SmtpSessionConfig instance)
Fill a builder with attribute values from the provided
SmtpSessionConfig instance. |
SmtpSessionConfig.Builder |
initialResponseReadTimeout(Duration initialResponseReadTimeout)
Initializes the optional value
initialResponseReadTimeout to initialResponseReadTimeout. |
SmtpSessionConfig.Builder |
initialResponseReadTimeout(Optional<Duration> initialResponseReadTimeout)
Initializes the optional value
initialResponseReadTimeout to initialResponseReadTimeout. |
SmtpSessionConfig.Builder |
keepAliveTimeout(Duration keepAliveTimeout)
Initializes the optional value
keepAliveTimeout to keepAliveTimeout. |
SmtpSessionConfig.Builder |
keepAliveTimeout(Optional<Duration> keepAliveTimeout)
Initializes the optional value
keepAliveTimeout to keepAliveTimeout. |
SmtpSessionConfig.Builder |
localAddress(InetSocketAddress localAddress)
Initializes the optional value
localAddress to localAddress. |
SmtpSessionConfig.Builder |
localAddress(Optional<InetSocketAddress> localAddress)
Initializes the optional value
localAddress to localAddress. |
SmtpSessionConfig.Builder |
readTimeout(Duration readTimeout)
Initializes the optional value
readTimeout to readTimeout. |
SmtpSessionConfig.Builder |
readTimeout(Optional<Duration> readTimeout)
Initializes the optional value
readTimeout to readTimeout. |
SmtpSessionConfig.Builder |
remoteAddress(InetSocketAddress remoteAddress)
Initializes the value for the
remoteAddress attribute. |
SmtpSessionConfig.Builder |
sendInterceptor(Optional<SendInterceptor> sendInterceptor)
Initializes the optional value
sendInterceptor to sendInterceptor. |
SmtpSessionConfig.Builder |
sendInterceptor(SendInterceptor sendInterceptor)
Initializes the optional value
sendInterceptor to sendInterceptor. |
public final SmtpSessionConfig.Builder from(SmtpSessionConfig instance)
SmtpSessionConfig
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 SmtpSessionConfig.Builder remoteAddress(InetSocketAddress remoteAddress)
remoteAddress
attribute.remoteAddress
- The value for remoteAddressthis
builder for use in a chained invocationpublic final SmtpSessionConfig.Builder localAddress(InetSocketAddress localAddress)
localAddress
to localAddress.localAddress
- The value for localAddressthis
builder for chained invocationpublic final SmtpSessionConfig.Builder localAddress(Optional<InetSocketAddress> localAddress)
localAddress
to localAddress.localAddress
- The value for localAddressthis
builder for use in a chained invocationpublic final SmtpSessionConfig.Builder keepAliveTimeout(Duration keepAliveTimeout)
keepAliveTimeout
to keepAliveTimeout.keepAliveTimeout
- The value for keepAliveTimeoutthis
builder for chained invocationpublic final SmtpSessionConfig.Builder keepAliveTimeout(Optional<Duration> keepAliveTimeout)
keepAliveTimeout
to keepAliveTimeout.keepAliveTimeout
- The value for keepAliveTimeoutthis
builder for use in a chained invocationpublic final SmtpSessionConfig.Builder readTimeout(Duration readTimeout)
readTimeout
to readTimeout.readTimeout
- The value for readTimeoutthis
builder for chained invocationpublic final SmtpSessionConfig.Builder readTimeout(Optional<Duration> readTimeout)
readTimeout
to readTimeout.readTimeout
- The value for readTimeoutthis
builder for use in a chained invocationpublic final SmtpSessionConfig.Builder initialResponseReadTimeout(Duration initialResponseReadTimeout)
initialResponseReadTimeout
to initialResponseReadTimeout.initialResponseReadTimeout
- The value for initialResponseReadTimeoutthis
builder for chained invocationpublic final SmtpSessionConfig.Builder initialResponseReadTimeout(Optional<Duration> initialResponseReadTimeout)
initialResponseReadTimeout
to initialResponseReadTimeout.initialResponseReadTimeout
- The value for initialResponseReadTimeoutthis
builder for use in a chained invocationpublic final SmtpSessionConfig.Builder sendInterceptor(SendInterceptor sendInterceptor)
sendInterceptor
to sendInterceptor.sendInterceptor
- The value for sendInterceptorthis
builder for chained invocationpublic final SmtpSessionConfig.Builder sendInterceptor(Optional<SendInterceptor> sendInterceptor)
sendInterceptor
to sendInterceptor.sendInterceptor
- The value for sendInterceptorthis
builder for use in a chained invocationpublic final SmtpSessionConfig.Builder exceptionHandler(Consumer<Throwable> exceptionHandler)
exceptionHandler
to exceptionHandler.exceptionHandler
- The value for exceptionHandlerthis
builder for chained invocationpublic final SmtpSessionConfig.Builder exceptionHandler(Optional<Consumer<Throwable>> exceptionHandler)
exceptionHandler
to exceptionHandler.exceptionHandler
- The value for exceptionHandlerthis
builder for use in a chained invocationpublic final SmtpSessionConfig.Builder connectionTimeout(Duration connectionTimeout)
connectionTimeout
attribute.
If not set, this attribute will have a default value as returned by the initializer of connectionTimeout
.
connectionTimeout
- The value for connectionTimeoutthis
builder for use in a chained invocationpublic final SmtpSessionConfig.Builder disabledExtensions(EnumSet<Extension> disabledExtensions)
disabledExtensions
attribute.
If not set, this attribute will have a default value as returned by the initializer of disabledExtensions
.
disabledExtensions
- The value for disabledExtensionsthis
builder for use in a chained invocationpublic final SmtpSessionConfig.Builder connectionId(String connectionId)
connectionId
attribute.
If not set, this attribute will have a default value as returned by the initializer of connectionId
.
connectionId
- The value for connectionIdthis
builder for use in a chained invocationpublic SmtpSessionConfig build()
SmtpSessionConfig
.IllegalStateException
- if any required attributes are missingCopyright © 2018. All rights reserved.