@ParametersAreNonnullByDefault @Generated(value={"Immutables.generator","AbstractSmtpSessionConfig"}) @Immutable public final class SmtpSessionConfig extends Object
AbstractSmtpSessionConfig
.
Use the builder to create immutable instances:
SmtpSessionConfig.builder()
.
Modifier and Type | Class and Description |
---|---|
static class |
SmtpSessionConfig.Builder
Builds instances of type
SmtpSessionConfig . |
Modifier and Type | Method and Description |
---|---|
static SmtpSessionConfig.Builder |
builder()
Creates a builder for
SmtpSessionConfig . |
protected void |
check() |
boolean |
equals(Object another)
This instance is equal to all instances of
SmtpSessionConfig that have equal attribute values. |
static SmtpSessionConfig |
forRemoteAddress(InetSocketAddress remoteAddress)
Creates a configuration for a connection to a server on the specified host and port.
|
static SmtpSessionConfig |
forRemoteAddress(String host,
int port)
Creates a configuration for a connection to a server on the specified host and port.
|
String |
getConnectionId()
An opaque string that will be logged with any errors on this connection.
|
Duration |
getConnectionTimeout()
The time to wait while connecting to a remote server.
|
EnumSet<Extension> |
getDisabledExtensions()
Extensions which should not be used when communicating with the remote server.
|
Optional<Consumer<Throwable>> |
getExceptionHandler()
A handler for exceptions that happen outside sending individual messages.
|
Optional<Duration> |
getInitialResponseReadTimeout()
The time to wait for the initial response from the server.
|
Optional<Duration> |
getKeepAliveTimeout()
The time to wait before sending a NOOP command to keep an
otherwise idle connection alive.
|
Optional<InetSocketAddress> |
getLocalAddress()
The local address and port to use when connecting to the remote server.
|
Optional<Duration> |
getReadTimeout()
The time to wait for a response from the server.
|
InetSocketAddress |
getRemoteAddress()
The host and port of the remote server.
|
Optional<SendInterceptor> |
getSendInterceptor()
A
SendInterceptor that can intercept commands and data before
they are sent to the server. |
int |
hashCode()
Computes a hash code from attributes:
remoteAddress , localAddress , keepAliveTimeout , readTimeout , initialResponseReadTimeout , sendInterceptor , exceptionHandler , connectionTimeout , disabledExtensions , connectionId . |
String |
toString()
Prints the immutable value
SmtpSessionConfig with attribute values. |
SmtpSessionConfig |
withConnectionId(String connectionId)
Copy the current immutable object by setting a value for the
connectionId attribute. |
SmtpSessionConfig |
withConnectionTimeout(Duration connectionTimeout)
Copy the current immutable object by setting a value for the
connectionTimeout attribute. |
SmtpSessionConfig |
withDisabledExtensions(EnumSet<Extension> disabledExtensions)
Copy the current immutable object by setting a value for the
disabledExtensions attribute. |
SmtpSessionConfig |
withExceptionHandler(Consumer<Throwable> value)
Copy the current immutable object by setting a present value for the optional
exceptionHandler attribute. |
SmtpSessionConfig |
withExceptionHandler(Optional<Consumer<Throwable>> optional)
Copy the current immutable object by setting an optional value for the
exceptionHandler attribute. |
SmtpSessionConfig |
withInitialResponseReadTimeout(Duration value)
Copy the current immutable object by setting a present value for the optional
initialResponseReadTimeout attribute. |
SmtpSessionConfig |
withInitialResponseReadTimeout(Optional<Duration> optional)
Copy the current immutable object by setting an optional value for the
initialResponseReadTimeout attribute. |
SmtpSessionConfig |
withKeepAliveTimeout(Duration value)
Copy the current immutable object by setting a present value for the optional
keepAliveTimeout attribute. |
SmtpSessionConfig |
withKeepAliveTimeout(Optional<Duration> optional)
Copy the current immutable object by setting an optional value for the
keepAliveTimeout attribute. |
SmtpSessionConfig |
withLocalAddress(InetSocketAddress value)
Copy the current immutable object by setting a present value for the optional
localAddress attribute. |
SmtpSessionConfig |
withLocalAddress(Optional<InetSocketAddress> optional)
Copy the current immutable object by setting an optional value for the
localAddress attribute. |
SmtpSessionConfig |
withReadTimeout(Duration value)
Copy the current immutable object by setting a present value for the optional
readTimeout attribute. |
SmtpSessionConfig |
withReadTimeout(Optional<Duration> optional)
Copy the current immutable object by setting an optional value for the
readTimeout attribute. |
SmtpSessionConfig |
withRemoteAddress(InetSocketAddress remoteAddress)
Copy the current immutable object by setting a value for the
remoteAddress attribute. |
SmtpSessionConfig |
withSendInterceptor(Optional<SendInterceptor> optional)
Copy the current immutable object by setting an optional value for the
sendInterceptor attribute. |
SmtpSessionConfig |
withSendInterceptor(SendInterceptor value)
Copy the current immutable object by setting a present value for the optional
sendInterceptor attribute. |
public InetSocketAddress getRemoteAddress()
public Optional<InetSocketAddress> getLocalAddress()
public Optional<Duration> getKeepAliveTimeout()
public Optional<Duration> getReadTimeout()
public Optional<Duration> getInitialResponseReadTimeout()
public Optional<SendInterceptor> getSendInterceptor()
SendInterceptor
that can intercept commands and data before
they are sent to the server.
SendInterceptor
s are especially useful when using the
SmtpSession#send
overloads that send multiple commands
for you. If you provide a SendInterceptor
to the send
method, it will take precedence over this one.
public Optional<Consumer<Throwable>> getExceptionHandler()
public Duration getConnectionTimeout()
public EnumSet<Extension> getDisabledExtensions()
This is useful if a server's EHLO response indicates supports for a particular extension but the implementation isn't working.
public String getConnectionId()
public final SmtpSessionConfig withRemoteAddress(InetSocketAddress remoteAddress)
remoteAddress
attribute.
A shallow reference equality check is used to prevent copying of the same value by returning this
.remoteAddress
- A new value for remoteAddressthis
objectpublic final SmtpSessionConfig withLocalAddress(InetSocketAddress value)
localAddress
attribute.value
- The value for localAddressthis
objectpublic final SmtpSessionConfig withLocalAddress(Optional<InetSocketAddress> optional)
localAddress
attribute.
A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this
.optional
- A value for localAddressthis
objectpublic final SmtpSessionConfig withKeepAliveTimeout(Duration value)
keepAliveTimeout
attribute.value
- The value for keepAliveTimeoutthis
objectpublic final SmtpSessionConfig withKeepAliveTimeout(Optional<Duration> optional)
keepAliveTimeout
attribute.
A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this
.optional
- A value for keepAliveTimeoutthis
objectpublic final SmtpSessionConfig withReadTimeout(Duration value)
readTimeout
attribute.value
- The value for readTimeoutthis
objectpublic final SmtpSessionConfig withReadTimeout(Optional<Duration> optional)
readTimeout
attribute.
A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this
.optional
- A value for readTimeoutthis
objectpublic final SmtpSessionConfig withInitialResponseReadTimeout(Duration value)
initialResponseReadTimeout
attribute.value
- The value for initialResponseReadTimeoutthis
objectpublic final SmtpSessionConfig withInitialResponseReadTimeout(Optional<Duration> optional)
initialResponseReadTimeout
attribute.
A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this
.optional
- A value for initialResponseReadTimeoutthis
objectpublic final SmtpSessionConfig withSendInterceptor(SendInterceptor value)
sendInterceptor
attribute.value
- The value for sendInterceptorthis
objectpublic final SmtpSessionConfig withSendInterceptor(Optional<SendInterceptor> optional)
sendInterceptor
attribute.
A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this
.optional
- A value for sendInterceptorthis
objectpublic final SmtpSessionConfig withExceptionHandler(Consumer<Throwable> value)
exceptionHandler
attribute.value
- The value for exceptionHandlerthis
objectpublic final SmtpSessionConfig withExceptionHandler(Optional<Consumer<Throwable>> optional)
exceptionHandler
attribute.
A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this
.optional
- A value for exceptionHandlerthis
objectpublic final SmtpSessionConfig withConnectionTimeout(Duration connectionTimeout)
connectionTimeout
attribute.
A shallow reference equality check is used to prevent copying of the same value by returning this
.connectionTimeout
- A new value for connectionTimeoutthis
objectpublic final SmtpSessionConfig withDisabledExtensions(EnumSet<Extension> disabledExtensions)
disabledExtensions
attribute.
A shallow reference equality check is used to prevent copying of the same value by returning this
.disabledExtensions
- A new value for disabledExtensionsthis
objectpublic final SmtpSessionConfig withConnectionId(String connectionId)
connectionId
attribute.
An equals check used to prevent copying of the same value by returning this
.connectionId
- A new value for connectionIdthis
objectpublic boolean equals(@Nullable Object another)
SmtpSessionConfig
that have equal attribute values.public int hashCode()
remoteAddress
, localAddress
, keepAliveTimeout
, readTimeout
, initialResponseReadTimeout
, sendInterceptor
, exceptionHandler
, connectionTimeout
, disabledExtensions
, connectionId
.public String toString()
SmtpSessionConfig
with attribute values.public static SmtpSessionConfig.Builder builder()
SmtpSessionConfig
.@Value.Check protected void check()
public static SmtpSessionConfig forRemoteAddress(String host, int port)
public static SmtpSessionConfig forRemoteAddress(InetSocketAddress remoteAddress)
Copyright © 2018. All rights reserved.