All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hubspot.imap.ImapClientConfiguration Maven / Gradle / Ivy

There is a newer version: 0.6.1
Show newest version
package com.hubspot.imap;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.common.net.HostAndPort;
import com.google.common.primitives.Booleans;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.Var;
import com.hubspot.imap.protocol.capabilities.AuthMechanism;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import javax.net.ssl.TrustManagerFactory;
import org.immutables.value.Generated;

/**
 * Immutable implementation of {@link ImapClientConfigurationIF}.
 * 

* Use the builder to create immutable instances: * {@code ImapClientConfiguration.builder()}. */ @Generated(from = "ImapClientConfigurationIF", generator = "Immutables") @SuppressWarnings({"all", "deprecation"}) @SuppressFBWarnings @ParametersAreNonnullByDefault @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImapClientConfiguration implements ImapClientConfigurationIF { private final HostAndPort hostAndPort; private transient final AuthMechanism authType; private final boolean useSsl; private final int noopKeepAliveIntervalSec; private final int socketTimeoutMs; private final int writeBackOffMs; private final int maxLineLength; private final int defaultResponseBufferSize; private final int connectTimeoutMillis; private final int closeTimeoutSec; private final int soLinger; private final boolean tracingEnabled; private final int maxHeaderCount; private final Optional trustManagerFactory; private final Optional proxyConfig; private final Optional socksProxyConfig; private final ImmutableList allowedAuthMechanisms; private ImapClientConfiguration(ImapClientConfiguration.Builder builder) { this.hostAndPort = builder.hostAndPort; if (builder.useSslIsSet()) { initShim.useSsl(builder.useSsl); } if (builder.noopKeepAliveIntervalSecIsSet()) { initShim.noopKeepAliveIntervalSec(builder.noopKeepAliveIntervalSec); } if (builder.socketTimeoutMsIsSet()) { initShim.socketTimeoutMs(builder.socketTimeoutMs); } if (builder.writeBackOffMsIsSet()) { initShim.writeBackOffMs(builder.writeBackOffMs); } if (builder.maxLineLengthIsSet()) { initShim.maxLineLength(builder.maxLineLength); } if (builder.defaultResponseBufferSizeIsSet()) { initShim.defaultResponseBufferSize(builder.defaultResponseBufferSize); } if (builder.connectTimeoutMillisIsSet()) { initShim.connectTimeoutMillis(builder.connectTimeoutMillis); } if (builder.closeTimeoutSecIsSet()) { initShim.closeTimeoutSec(builder.closeTimeoutSec); } if (builder.soLingerIsSet()) { initShim.soLinger(builder.soLinger); } if (builder.tracingEnabledIsSet()) { initShim.tracingEnabled(builder.tracingEnabled); } if (builder.maxHeaderCountIsSet()) { initShim.maxHeaderCount(builder.maxHeaderCount); } if (builder.trustManagerFactory != null) { initShim.trustManagerFactory(builder.trustManagerFactory); } if (builder.proxyConfig != null) { initShim.proxyConfig(builder.proxyConfig); } if (builder.socksProxyConfig != null) { initShim.socksProxyConfig(builder.socksProxyConfig); } if (builder.allowedAuthMechanismsIsSet()) { initShim.allowedAuthMechanisms(builder.allowedAuthMechanisms.build()); } this.authType = initShim.authType(); this.useSsl = initShim.useSsl(); this.noopKeepAliveIntervalSec = initShim.noopKeepAliveIntervalSec(); this.socketTimeoutMs = initShim.socketTimeoutMs(); this.writeBackOffMs = initShim.writeBackOffMs(); this.maxLineLength = initShim.maxLineLength(); this.defaultResponseBufferSize = initShim.defaultResponseBufferSize(); this.connectTimeoutMillis = initShim.connectTimeoutMillis(); this.closeTimeoutSec = initShim.closeTimeoutSec(); this.soLinger = initShim.soLinger(); this.tracingEnabled = initShim.tracingEnabled(); this.maxHeaderCount = initShim.maxHeaderCount(); this.trustManagerFactory = initShim.trustManagerFactory(); this.proxyConfig = initShim.proxyConfig(); this.socksProxyConfig = initShim.socksProxyConfig(); this.allowedAuthMechanisms = initShim.allowedAuthMechanisms(); this.initShim = null; } private ImapClientConfiguration( HostAndPort hostAndPort, boolean useSsl, int noopKeepAliveIntervalSec, int socketTimeoutMs, int writeBackOffMs, int maxLineLength, int defaultResponseBufferSize, int connectTimeoutMillis, int closeTimeoutSec, int soLinger, boolean tracingEnabled, int maxHeaderCount, Optional trustManagerFactory, Optional proxyConfig, Optional socksProxyConfig, ImmutableList allowedAuthMechanisms) { this.hostAndPort = hostAndPort; initShim.useSsl(useSsl); initShim.noopKeepAliveIntervalSec(noopKeepAliveIntervalSec); initShim.socketTimeoutMs(socketTimeoutMs); initShim.writeBackOffMs(writeBackOffMs); initShim.maxLineLength(maxLineLength); initShim.defaultResponseBufferSize(defaultResponseBufferSize); initShim.connectTimeoutMillis(connectTimeoutMillis); initShim.closeTimeoutSec(closeTimeoutSec); initShim.soLinger(soLinger); initShim.tracingEnabled(tracingEnabled); initShim.maxHeaderCount(maxHeaderCount); initShim.trustManagerFactory(trustManagerFactory); initShim.proxyConfig(proxyConfig); initShim.socksProxyConfig(socksProxyConfig); initShim.allowedAuthMechanisms(allowedAuthMechanisms); this.authType = initShim.authType(); this.useSsl = initShim.useSsl(); this.noopKeepAliveIntervalSec = initShim.noopKeepAliveIntervalSec(); this.socketTimeoutMs = initShim.socketTimeoutMs(); this.writeBackOffMs = initShim.writeBackOffMs(); this.maxLineLength = initShim.maxLineLength(); this.defaultResponseBufferSize = initShim.defaultResponseBufferSize(); this.connectTimeoutMillis = initShim.connectTimeoutMillis(); this.closeTimeoutSec = initShim.closeTimeoutSec(); this.soLinger = initShim.soLinger(); this.tracingEnabled = initShim.tracingEnabled(); this.maxHeaderCount = initShim.maxHeaderCount(); this.trustManagerFactory = initShim.trustManagerFactory(); this.proxyConfig = initShim.proxyConfig(); this.socksProxyConfig = initShim.socksProxyConfig(); this.allowedAuthMechanisms = initShim.allowedAuthMechanisms(); this.initShim = null; } private static final byte STAGE_INITIALIZING = -1; private static final byte STAGE_UNINITIALIZED = 0; private static final byte STAGE_INITIALIZED = 1; @SuppressWarnings("Immutable") private transient volatile InitShim initShim = new InitShim(); @Generated(from = "ImapClientConfigurationIF", generator = "Immutables") private final class InitShim { private byte authTypeBuildStage = STAGE_UNINITIALIZED; private AuthMechanism authType; AuthMechanism authType() { if (authTypeBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (authTypeBuildStage == STAGE_UNINITIALIZED) { authTypeBuildStage = STAGE_INITIALIZING; this.authType = Objects.requireNonNull(authTypeInitialize(), "authType"); authTypeBuildStage = STAGE_INITIALIZED; } return this.authType; } private byte useSslBuildStage = STAGE_UNINITIALIZED; private boolean useSsl; boolean useSsl() { if (useSslBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (useSslBuildStage == STAGE_UNINITIALIZED) { useSslBuildStage = STAGE_INITIALIZING; this.useSsl = useSslInitialize(); useSslBuildStage = STAGE_INITIALIZED; } return this.useSsl; } void useSsl(boolean useSsl) { this.useSsl = useSsl; useSslBuildStage = STAGE_INITIALIZED; } private byte noopKeepAliveIntervalSecBuildStage = STAGE_UNINITIALIZED; private int noopKeepAliveIntervalSec; int noopKeepAliveIntervalSec() { if (noopKeepAliveIntervalSecBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (noopKeepAliveIntervalSecBuildStage == STAGE_UNINITIALIZED) { noopKeepAliveIntervalSecBuildStage = STAGE_INITIALIZING; this.noopKeepAliveIntervalSec = noopKeepAliveIntervalSecInitialize(); noopKeepAliveIntervalSecBuildStage = STAGE_INITIALIZED; } return this.noopKeepAliveIntervalSec; } void noopKeepAliveIntervalSec(int noopKeepAliveIntervalSec) { this.noopKeepAliveIntervalSec = noopKeepAliveIntervalSec; noopKeepAliveIntervalSecBuildStage = STAGE_INITIALIZED; } private byte socketTimeoutMsBuildStage = STAGE_UNINITIALIZED; private int socketTimeoutMs; int socketTimeoutMs() { if (socketTimeoutMsBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (socketTimeoutMsBuildStage == STAGE_UNINITIALIZED) { socketTimeoutMsBuildStage = STAGE_INITIALIZING; this.socketTimeoutMs = socketTimeoutMsInitialize(); socketTimeoutMsBuildStage = STAGE_INITIALIZED; } return this.socketTimeoutMs; } void socketTimeoutMs(int socketTimeoutMs) { this.socketTimeoutMs = socketTimeoutMs; socketTimeoutMsBuildStage = STAGE_INITIALIZED; } private byte writeBackOffMsBuildStage = STAGE_UNINITIALIZED; private int writeBackOffMs; int writeBackOffMs() { if (writeBackOffMsBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (writeBackOffMsBuildStage == STAGE_UNINITIALIZED) { writeBackOffMsBuildStage = STAGE_INITIALIZING; this.writeBackOffMs = writeBackOffMsInitialize(); writeBackOffMsBuildStage = STAGE_INITIALIZED; } return this.writeBackOffMs; } void writeBackOffMs(int writeBackOffMs) { this.writeBackOffMs = writeBackOffMs; writeBackOffMsBuildStage = STAGE_INITIALIZED; } private byte maxLineLengthBuildStage = STAGE_UNINITIALIZED; private int maxLineLength; int maxLineLength() { if (maxLineLengthBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (maxLineLengthBuildStage == STAGE_UNINITIALIZED) { maxLineLengthBuildStage = STAGE_INITIALIZING; this.maxLineLength = maxLineLengthInitialize(); maxLineLengthBuildStage = STAGE_INITIALIZED; } return this.maxLineLength; } void maxLineLength(int maxLineLength) { this.maxLineLength = maxLineLength; maxLineLengthBuildStage = STAGE_INITIALIZED; } private byte defaultResponseBufferSizeBuildStage = STAGE_UNINITIALIZED; private int defaultResponseBufferSize; int defaultResponseBufferSize() { if (defaultResponseBufferSizeBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (defaultResponseBufferSizeBuildStage == STAGE_UNINITIALIZED) { defaultResponseBufferSizeBuildStage = STAGE_INITIALIZING; this.defaultResponseBufferSize = defaultResponseBufferSizeInitialize(); defaultResponseBufferSizeBuildStage = STAGE_INITIALIZED; } return this.defaultResponseBufferSize; } void defaultResponseBufferSize(int defaultResponseBufferSize) { this.defaultResponseBufferSize = defaultResponseBufferSize; defaultResponseBufferSizeBuildStage = STAGE_INITIALIZED; } private byte connectTimeoutMillisBuildStage = STAGE_UNINITIALIZED; private int connectTimeoutMillis; int connectTimeoutMillis() { if (connectTimeoutMillisBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (connectTimeoutMillisBuildStage == STAGE_UNINITIALIZED) { connectTimeoutMillisBuildStage = STAGE_INITIALIZING; this.connectTimeoutMillis = connectTimeoutMillisInitialize(); connectTimeoutMillisBuildStage = STAGE_INITIALIZED; } return this.connectTimeoutMillis; } void connectTimeoutMillis(int connectTimeoutMillis) { this.connectTimeoutMillis = connectTimeoutMillis; connectTimeoutMillisBuildStage = STAGE_INITIALIZED; } private byte closeTimeoutSecBuildStage = STAGE_UNINITIALIZED; private int closeTimeoutSec; int closeTimeoutSec() { if (closeTimeoutSecBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (closeTimeoutSecBuildStage == STAGE_UNINITIALIZED) { closeTimeoutSecBuildStage = STAGE_INITIALIZING; this.closeTimeoutSec = closeTimeoutSecInitialize(); closeTimeoutSecBuildStage = STAGE_INITIALIZED; } return this.closeTimeoutSec; } void closeTimeoutSec(int closeTimeoutSec) { this.closeTimeoutSec = closeTimeoutSec; closeTimeoutSecBuildStage = STAGE_INITIALIZED; } private byte soLingerBuildStage = STAGE_UNINITIALIZED; private int soLinger; int soLinger() { if (soLingerBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (soLingerBuildStage == STAGE_UNINITIALIZED) { soLingerBuildStage = STAGE_INITIALIZING; this.soLinger = soLingerInitialize(); soLingerBuildStage = STAGE_INITIALIZED; } return this.soLinger; } void soLinger(int soLinger) { this.soLinger = soLinger; soLingerBuildStage = STAGE_INITIALIZED; } private byte tracingEnabledBuildStage = STAGE_UNINITIALIZED; private boolean tracingEnabled; boolean tracingEnabled() { if (tracingEnabledBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (tracingEnabledBuildStage == STAGE_UNINITIALIZED) { tracingEnabledBuildStage = STAGE_INITIALIZING; this.tracingEnabled = tracingEnabledInitialize(); tracingEnabledBuildStage = STAGE_INITIALIZED; } return this.tracingEnabled; } void tracingEnabled(boolean tracingEnabled) { this.tracingEnabled = tracingEnabled; tracingEnabledBuildStage = STAGE_INITIALIZED; } private byte maxHeaderCountBuildStage = STAGE_UNINITIALIZED; private int maxHeaderCount; int maxHeaderCount() { if (maxHeaderCountBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (maxHeaderCountBuildStage == STAGE_UNINITIALIZED) { maxHeaderCountBuildStage = STAGE_INITIALIZING; this.maxHeaderCount = maxHeaderCountInitialize(); maxHeaderCountBuildStage = STAGE_INITIALIZED; } return this.maxHeaderCount; } void maxHeaderCount(int maxHeaderCount) { this.maxHeaderCount = maxHeaderCount; maxHeaderCountBuildStage = STAGE_INITIALIZED; } private byte trustManagerFactoryBuildStage = STAGE_UNINITIALIZED; private Optional trustManagerFactory; Optional trustManagerFactory() { if (trustManagerFactoryBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (trustManagerFactoryBuildStage == STAGE_UNINITIALIZED) { trustManagerFactoryBuildStage = STAGE_INITIALIZING; this.trustManagerFactory = Objects.requireNonNull(trustManagerFactoryInitialize(), "trustManagerFactory"); trustManagerFactoryBuildStage = STAGE_INITIALIZED; } return this.trustManagerFactory; } void trustManagerFactory(Optional trustManagerFactory) { this.trustManagerFactory = trustManagerFactory; trustManagerFactoryBuildStage = STAGE_INITIALIZED; } private byte proxyConfigBuildStage = STAGE_UNINITIALIZED; private Optional proxyConfig; Optional proxyConfig() { if (proxyConfigBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (proxyConfigBuildStage == STAGE_UNINITIALIZED) { proxyConfigBuildStage = STAGE_INITIALIZING; this.proxyConfig = Objects.requireNonNull(proxyConfigInitialize(), "proxyConfig"); proxyConfigBuildStage = STAGE_INITIALIZED; } return this.proxyConfig; } void proxyConfig(Optional proxyConfig) { this.proxyConfig = proxyConfig; proxyConfigBuildStage = STAGE_INITIALIZED; } private byte socksProxyConfigBuildStage = STAGE_UNINITIALIZED; private Optional socksProxyConfig; Optional socksProxyConfig() { if (socksProxyConfigBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (socksProxyConfigBuildStage == STAGE_UNINITIALIZED) { socksProxyConfigBuildStage = STAGE_INITIALIZING; this.socksProxyConfig = Objects.requireNonNull(socksProxyConfigInitialize(), "socksProxyConfig"); socksProxyConfigBuildStage = STAGE_INITIALIZED; } return this.socksProxyConfig; } void socksProxyConfig(Optional socksProxyConfig) { this.socksProxyConfig = socksProxyConfig; socksProxyConfigBuildStage = STAGE_INITIALIZED; } private byte allowedAuthMechanismsBuildStage = STAGE_UNINITIALIZED; private ImmutableList allowedAuthMechanisms; ImmutableList allowedAuthMechanisms() { if (allowedAuthMechanismsBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (allowedAuthMechanismsBuildStage == STAGE_UNINITIALIZED) { allowedAuthMechanismsBuildStage = STAGE_INITIALIZING; this.allowedAuthMechanisms = ImmutableList.copyOf(allowedAuthMechanismsInitialize()); allowedAuthMechanismsBuildStage = STAGE_INITIALIZED; } return this.allowedAuthMechanisms; } void allowedAuthMechanisms(ImmutableList allowedAuthMechanisms) { this.allowedAuthMechanisms = allowedAuthMechanisms; allowedAuthMechanismsBuildStage = STAGE_INITIALIZED; } private String formatInitCycleMessage() { List attributes = new ArrayList<>(); if (authTypeBuildStage == STAGE_INITIALIZING) attributes.add("authType"); if (useSslBuildStage == STAGE_INITIALIZING) attributes.add("useSsl"); if (noopKeepAliveIntervalSecBuildStage == STAGE_INITIALIZING) attributes.add("noopKeepAliveIntervalSec"); if (socketTimeoutMsBuildStage == STAGE_INITIALIZING) attributes.add("socketTimeoutMs"); if (writeBackOffMsBuildStage == STAGE_INITIALIZING) attributes.add("writeBackOffMs"); if (maxLineLengthBuildStage == STAGE_INITIALIZING) attributes.add("maxLineLength"); if (defaultResponseBufferSizeBuildStage == STAGE_INITIALIZING) attributes.add("defaultResponseBufferSize"); if (connectTimeoutMillisBuildStage == STAGE_INITIALIZING) attributes.add("connectTimeoutMillis"); if (closeTimeoutSecBuildStage == STAGE_INITIALIZING) attributes.add("closeTimeoutSec"); if (soLingerBuildStage == STAGE_INITIALIZING) attributes.add("soLinger"); if (tracingEnabledBuildStage == STAGE_INITIALIZING) attributes.add("tracingEnabled"); if (maxHeaderCountBuildStage == STAGE_INITIALIZING) attributes.add("maxHeaderCount"); if (trustManagerFactoryBuildStage == STAGE_INITIALIZING) attributes.add("trustManagerFactory"); if (proxyConfigBuildStage == STAGE_INITIALIZING) attributes.add("proxyConfig"); if (socksProxyConfigBuildStage == STAGE_INITIALIZING) attributes.add("socksProxyConfig"); if (allowedAuthMechanismsBuildStage == STAGE_INITIALIZING) attributes.add("allowedAuthMechanisms"); return "Cannot build ImapClientConfiguration, attribute initializers form cycle " + attributes; } } private AuthMechanism authTypeInitialize() { return ImapClientConfigurationIF.super.authType(); } private boolean useSslInitialize() { return ImapClientConfigurationIF.super.useSsl(); } private int noopKeepAliveIntervalSecInitialize() { return ImapClientConfigurationIF.super.noopKeepAliveIntervalSec(); } private int socketTimeoutMsInitialize() { return ImapClientConfigurationIF.super.socketTimeoutMs(); } private int writeBackOffMsInitialize() { return ImapClientConfigurationIF.super.writeBackOffMs(); } private int maxLineLengthInitialize() { return ImapClientConfigurationIF.super.maxLineLength(); } private int defaultResponseBufferSizeInitialize() { return ImapClientConfigurationIF.super.defaultResponseBufferSize(); } private int connectTimeoutMillisInitialize() { return ImapClientConfigurationIF.super.connectTimeoutMillis(); } private int closeTimeoutSecInitialize() { return ImapClientConfigurationIF.super.closeTimeoutSec(); } private int soLingerInitialize() { return ImapClientConfigurationIF.super.soLinger(); } private boolean tracingEnabledInitialize() { return ImapClientConfigurationIF.super.tracingEnabled(); } private int maxHeaderCountInitialize() { return ImapClientConfigurationIF.super.maxHeaderCount(); } private Optional trustManagerFactoryInitialize() { return ImapClientConfigurationIF.super.trustManagerFactory(); } private Optional proxyConfigInitialize() { return ImapClientConfigurationIF.super.proxyConfig(); } private Optional socksProxyConfigInitialize() { return ImapClientConfigurationIF.super.socksProxyConfig(); } private List allowedAuthMechanismsInitialize() { return ImapClientConfigurationIF.super.allowedAuthMechanisms(); } /** * @return The value of the {@code hostAndPort} attribute */ @JsonProperty("hostAndPort") @Override public HostAndPort hostAndPort() { return hostAndPort; } /** * @deprecated please use {@link #allowedAuthMechanisms()} instead. */ @JsonProperty("authType") @Deprecated @Override public AuthMechanism authType() { InitShim shim = this.initShim; return shim != null ? shim.authType() : this.authType; } /** * @return The value of the {@code useSsl} attribute */ @JsonProperty("useSsl") @Override public boolean useSsl() { InitShim shim = this.initShim; return shim != null ? shim.useSsl() : this.useSsl; } /** * @return The value of the {@code noopKeepAliveIntervalSec} attribute */ @JsonProperty("noopKeepAliveIntervalSec") @Override public int noopKeepAliveIntervalSec() { InitShim shim = this.initShim; return shim != null ? shim.noopKeepAliveIntervalSec() : this.noopKeepAliveIntervalSec; } /** * @return The value of the {@code socketTimeoutMs} attribute */ @JsonProperty("socketTimeoutMs") @Override public int socketTimeoutMs() { InitShim shim = this.initShim; return shim != null ? shim.socketTimeoutMs() : this.socketTimeoutMs; } /** * @return The value of the {@code writeBackOffMs} attribute */ @JsonProperty("writeBackOffMs") @Override public int writeBackOffMs() { InitShim shim = this.initShim; return shim != null ? shim.writeBackOffMs() : this.writeBackOffMs; } /** * @return The value of the {@code maxLineLength} attribute */ @JsonProperty("maxLineLength") @Override public int maxLineLength() { InitShim shim = this.initShim; return shim != null ? shim.maxLineLength() : this.maxLineLength; } /** * @return The value of the {@code defaultResponseBufferSize} attribute */ @JsonProperty("defaultResponseBufferSize") @Override public int defaultResponseBufferSize() { InitShim shim = this.initShim; return shim != null ? shim.defaultResponseBufferSize() : this.defaultResponseBufferSize; } /** * @return The value of the {@code connectTimeoutMillis} attribute */ @JsonProperty("connectTimeoutMillis") @Override public int connectTimeoutMillis() { InitShim shim = this.initShim; return shim != null ? shim.connectTimeoutMillis() : this.connectTimeoutMillis; } /** * @return The value of the {@code closeTimeoutSec} attribute */ @JsonProperty("closeTimeoutSec") @Override public int closeTimeoutSec() { InitShim shim = this.initShim; return shim != null ? shim.closeTimeoutSec() : this.closeTimeoutSec; } /** * @return The value of the {@code soLinger} attribute */ @JsonProperty("soLinger") @Override public int soLinger() { InitShim shim = this.initShim; return shim != null ? shim.soLinger() : this.soLinger; } /** * @return The value of the {@code tracingEnabled} attribute */ @JsonProperty("tracingEnabled") @Override public boolean tracingEnabled() { InitShim shim = this.initShim; return shim != null ? shim.tracingEnabled() : this.tracingEnabled; } /** * @return The value of the {@code maxHeaderCount} attribute */ @JsonProperty("maxHeaderCount") @Override public int maxHeaderCount() { InitShim shim = this.initShim; return shim != null ? shim.maxHeaderCount() : this.maxHeaderCount; } /** * @return The value of the {@code trustManagerFactory} attribute */ @JsonProperty("trustManagerFactory") @Override public Optional trustManagerFactory() { InitShim shim = this.initShim; return shim != null ? shim.trustManagerFactory() : this.trustManagerFactory; } /** * @return The value of the {@code proxyConfig} attribute */ @JsonProperty("proxyConfig") @Override public Optional proxyConfig() { InitShim shim = this.initShim; return shim != null ? shim.proxyConfig() : this.proxyConfig; } /** * @return The value of the {@code socksProxyConfig} attribute */ @JsonProperty("socksProxyConfig") @Override public Optional socksProxyConfig() { InitShim shim = this.initShim; return shim != null ? shim.socksProxyConfig() : this.socksProxyConfig; } /** * @return The value of the {@code allowedAuthMechanisms} attribute */ @JsonProperty("allowedAuthMechanisms") @Override public ImmutableList allowedAuthMechanisms() { InitShim shim = this.initShim; return shim != null ? shim.allowedAuthMechanisms() : this.allowedAuthMechanisms; } /** * Copy the current immutable object by setting a value for the {@link ImapClientConfigurationIF#hostAndPort() hostAndPort} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for hostAndPort * @return A modified copy of the {@code this} object */ public final ImapClientConfiguration withHostAndPort(HostAndPort value) { if (this.hostAndPort == value) return this; HostAndPort newValue = Objects.requireNonNull(value, "hostAndPort"); return new ImapClientConfiguration( newValue, this.useSsl, this.noopKeepAliveIntervalSec, this.socketTimeoutMs, this.writeBackOffMs, this.maxLineLength, this.defaultResponseBufferSize, this.connectTimeoutMillis, this.closeTimeoutSec, this.soLinger, this.tracingEnabled, this.maxHeaderCount, this.trustManagerFactory, this.proxyConfig, this.socksProxyConfig, this.allowedAuthMechanisms); } /** * Copy the current immutable object by setting a value for the {@link ImapClientConfigurationIF#useSsl() useSsl} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for useSsl * @return A modified copy of the {@code this} object */ public final ImapClientConfiguration withUseSsl(boolean value) { if (this.useSsl == value) return this; return new ImapClientConfiguration( this.hostAndPort, value, this.noopKeepAliveIntervalSec, this.socketTimeoutMs, this.writeBackOffMs, this.maxLineLength, this.defaultResponseBufferSize, this.connectTimeoutMillis, this.closeTimeoutSec, this.soLinger, this.tracingEnabled, this.maxHeaderCount, this.trustManagerFactory, this.proxyConfig, this.socksProxyConfig, this.allowedAuthMechanisms); } /** * Copy the current immutable object by setting a value for the {@link ImapClientConfigurationIF#noopKeepAliveIntervalSec() noopKeepAliveIntervalSec} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for noopKeepAliveIntervalSec * @return A modified copy of the {@code this} object */ public final ImapClientConfiguration withNoopKeepAliveIntervalSec(int value) { if (this.noopKeepAliveIntervalSec == value) return this; return new ImapClientConfiguration( this.hostAndPort, this.useSsl, value, this.socketTimeoutMs, this.writeBackOffMs, this.maxLineLength, this.defaultResponseBufferSize, this.connectTimeoutMillis, this.closeTimeoutSec, this.soLinger, this.tracingEnabled, this.maxHeaderCount, this.trustManagerFactory, this.proxyConfig, this.socksProxyConfig, this.allowedAuthMechanisms); } /** * Copy the current immutable object by setting a value for the {@link ImapClientConfigurationIF#socketTimeoutMs() socketTimeoutMs} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for socketTimeoutMs * @return A modified copy of the {@code this} object */ public final ImapClientConfiguration withSocketTimeoutMs(int value) { if (this.socketTimeoutMs == value) return this; return new ImapClientConfiguration( this.hostAndPort, this.useSsl, this.noopKeepAliveIntervalSec, value, this.writeBackOffMs, this.maxLineLength, this.defaultResponseBufferSize, this.connectTimeoutMillis, this.closeTimeoutSec, this.soLinger, this.tracingEnabled, this.maxHeaderCount, this.trustManagerFactory, this.proxyConfig, this.socksProxyConfig, this.allowedAuthMechanisms); } /** * Copy the current immutable object by setting a value for the {@link ImapClientConfigurationIF#writeBackOffMs() writeBackOffMs} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for writeBackOffMs * @return A modified copy of the {@code this} object */ public final ImapClientConfiguration withWriteBackOffMs(int value) { if (this.writeBackOffMs == value) return this; return new ImapClientConfiguration( this.hostAndPort, this.useSsl, this.noopKeepAliveIntervalSec, this.socketTimeoutMs, value, this.maxLineLength, this.defaultResponseBufferSize, this.connectTimeoutMillis, this.closeTimeoutSec, this.soLinger, this.tracingEnabled, this.maxHeaderCount, this.trustManagerFactory, this.proxyConfig, this.socksProxyConfig, this.allowedAuthMechanisms); } /** * Copy the current immutable object by setting a value for the {@link ImapClientConfigurationIF#maxLineLength() maxLineLength} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for maxLineLength * @return A modified copy of the {@code this} object */ public final ImapClientConfiguration withMaxLineLength(int value) { if (this.maxLineLength == value) return this; return new ImapClientConfiguration( this.hostAndPort, this.useSsl, this.noopKeepAliveIntervalSec, this.socketTimeoutMs, this.writeBackOffMs, value, this.defaultResponseBufferSize, this.connectTimeoutMillis, this.closeTimeoutSec, this.soLinger, this.tracingEnabled, this.maxHeaderCount, this.trustManagerFactory, this.proxyConfig, this.socksProxyConfig, this.allowedAuthMechanisms); } /** * Copy the current immutable object by setting a value for the {@link ImapClientConfigurationIF#defaultResponseBufferSize() defaultResponseBufferSize} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for defaultResponseBufferSize * @return A modified copy of the {@code this} object */ public final ImapClientConfiguration withDefaultResponseBufferSize(int value) { if (this.defaultResponseBufferSize == value) return this; return new ImapClientConfiguration( this.hostAndPort, this.useSsl, this.noopKeepAliveIntervalSec, this.socketTimeoutMs, this.writeBackOffMs, this.maxLineLength, value, this.connectTimeoutMillis, this.closeTimeoutSec, this.soLinger, this.tracingEnabled, this.maxHeaderCount, this.trustManagerFactory, this.proxyConfig, this.socksProxyConfig, this.allowedAuthMechanisms); } /** * Copy the current immutable object by setting a value for the {@link ImapClientConfigurationIF#connectTimeoutMillis() connectTimeoutMillis} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for connectTimeoutMillis * @return A modified copy of the {@code this} object */ public final ImapClientConfiguration withConnectTimeoutMillis(int value) { if (this.connectTimeoutMillis == value) return this; return new ImapClientConfiguration( this.hostAndPort, this.useSsl, this.noopKeepAliveIntervalSec, this.socketTimeoutMs, this.writeBackOffMs, this.maxLineLength, this.defaultResponseBufferSize, value, this.closeTimeoutSec, this.soLinger, this.tracingEnabled, this.maxHeaderCount, this.trustManagerFactory, this.proxyConfig, this.socksProxyConfig, this.allowedAuthMechanisms); } /** * Copy the current immutable object by setting a value for the {@link ImapClientConfigurationIF#closeTimeoutSec() closeTimeoutSec} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for closeTimeoutSec * @return A modified copy of the {@code this} object */ public final ImapClientConfiguration withCloseTimeoutSec(int value) { if (this.closeTimeoutSec == value) return this; return new ImapClientConfiguration( this.hostAndPort, this.useSsl, this.noopKeepAliveIntervalSec, this.socketTimeoutMs, this.writeBackOffMs, this.maxLineLength, this.defaultResponseBufferSize, this.connectTimeoutMillis, value, this.soLinger, this.tracingEnabled, this.maxHeaderCount, this.trustManagerFactory, this.proxyConfig, this.socksProxyConfig, this.allowedAuthMechanisms); } /** * Copy the current immutable object by setting a value for the {@link ImapClientConfigurationIF#soLinger() soLinger} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for soLinger * @return A modified copy of the {@code this} object */ public final ImapClientConfiguration withSoLinger(int value) { if (this.soLinger == value) return this; return new ImapClientConfiguration( this.hostAndPort, this.useSsl, this.noopKeepAliveIntervalSec, this.socketTimeoutMs, this.writeBackOffMs, this.maxLineLength, this.defaultResponseBufferSize, this.connectTimeoutMillis, this.closeTimeoutSec, value, this.tracingEnabled, this.maxHeaderCount, this.trustManagerFactory, this.proxyConfig, this.socksProxyConfig, this.allowedAuthMechanisms); } /** * Copy the current immutable object by setting a value for the {@link ImapClientConfigurationIF#tracingEnabled() tracingEnabled} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for tracingEnabled * @return A modified copy of the {@code this} object */ public final ImapClientConfiguration withTracingEnabled(boolean value) { if (this.tracingEnabled == value) return this; return new ImapClientConfiguration( this.hostAndPort, this.useSsl, this.noopKeepAliveIntervalSec, this.socketTimeoutMs, this.writeBackOffMs, this.maxLineLength, this.defaultResponseBufferSize, this.connectTimeoutMillis, this.closeTimeoutSec, this.soLinger, value, this.maxHeaderCount, this.trustManagerFactory, this.proxyConfig, this.socksProxyConfig, this.allowedAuthMechanisms); } /** * Copy the current immutable object by setting a value for the {@link ImapClientConfigurationIF#maxHeaderCount() maxHeaderCount} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for maxHeaderCount * @return A modified copy of the {@code this} object */ public final ImapClientConfiguration withMaxHeaderCount(int value) { if (this.maxHeaderCount == value) return this; return new ImapClientConfiguration( this.hostAndPort, this.useSsl, this.noopKeepAliveIntervalSec, this.socketTimeoutMs, this.writeBackOffMs, this.maxLineLength, this.defaultResponseBufferSize, this.connectTimeoutMillis, this.closeTimeoutSec, this.soLinger, this.tracingEnabled, value, this.trustManagerFactory, this.proxyConfig, this.socksProxyConfig, this.allowedAuthMechanisms); } /** * Copy the current immutable object by setting a value for the {@link ImapClientConfigurationIF#trustManagerFactory() trustManagerFactory} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for trustManagerFactory * @return A modified copy of the {@code this} object */ public final ImapClientConfiguration withTrustManagerFactory(Optional value) { Optional newValue = Objects.requireNonNull(value, "trustManagerFactory"); if (this.trustManagerFactory.equals(newValue)) return this; return new ImapClientConfiguration( this.hostAndPort, this.useSsl, this.noopKeepAliveIntervalSec, this.socketTimeoutMs, this.writeBackOffMs, this.maxLineLength, this.defaultResponseBufferSize, this.connectTimeoutMillis, this.closeTimeoutSec, this.soLinger, this.tracingEnabled, this.maxHeaderCount, newValue, this.proxyConfig, this.socksProxyConfig, this.allowedAuthMechanisms); } /** * Copy the current immutable object by setting a value for the {@link ImapClientConfigurationIF#proxyConfig() proxyConfig} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for proxyConfig * @return A modified copy of the {@code this} object */ public final ImapClientConfiguration withProxyConfig(Optional value) { Optional newValue = Objects.requireNonNull(value, "proxyConfig"); if (this.proxyConfig.equals(newValue)) return this; return new ImapClientConfiguration( this.hostAndPort, this.useSsl, this.noopKeepAliveIntervalSec, this.socketTimeoutMs, this.writeBackOffMs, this.maxLineLength, this.defaultResponseBufferSize, this.connectTimeoutMillis, this.closeTimeoutSec, this.soLinger, this.tracingEnabled, this.maxHeaderCount, this.trustManagerFactory, newValue, this.socksProxyConfig, this.allowedAuthMechanisms); } /** * Copy the current immutable object by setting a value for the {@link ImapClientConfigurationIF#socksProxyConfig() socksProxyConfig} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for socksProxyConfig * @return A modified copy of the {@code this} object */ public final ImapClientConfiguration withSocksProxyConfig(Optional value) { Optional newValue = Objects.requireNonNull(value, "socksProxyConfig"); if (this.socksProxyConfig.equals(newValue)) return this; return new ImapClientConfiguration( this.hostAndPort, this.useSsl, this.noopKeepAliveIntervalSec, this.socketTimeoutMs, this.writeBackOffMs, this.maxLineLength, this.defaultResponseBufferSize, this.connectTimeoutMillis, this.closeTimeoutSec, this.soLinger, this.tracingEnabled, this.maxHeaderCount, this.trustManagerFactory, this.proxyConfig, newValue, this.allowedAuthMechanisms); } /** * Copy the current immutable object with elements that replace the content of {@link ImapClientConfigurationIF#allowedAuthMechanisms() allowedAuthMechanisms}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImapClientConfiguration withAllowedAuthMechanisms(AuthMechanism... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImapClientConfiguration( this.hostAndPort, this.useSsl, this.noopKeepAliveIntervalSec, this.socketTimeoutMs, this.writeBackOffMs, this.maxLineLength, this.defaultResponseBufferSize, this.connectTimeoutMillis, this.closeTimeoutSec, this.soLinger, this.tracingEnabled, this.maxHeaderCount, this.trustManagerFactory, this.proxyConfig, this.socksProxyConfig, newValue); } /** * Copy the current immutable object with elements that replace the content of {@link ImapClientConfigurationIF#allowedAuthMechanisms() allowedAuthMechanisms}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of allowedAuthMechanisms elements to set * @return A modified copy of {@code this} object */ public final ImapClientConfiguration withAllowedAuthMechanisms(Iterable elements) { if (this.allowedAuthMechanisms == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImapClientConfiguration( this.hostAndPort, this.useSsl, this.noopKeepAliveIntervalSec, this.socketTimeoutMs, this.writeBackOffMs, this.maxLineLength, this.defaultResponseBufferSize, this.connectTimeoutMillis, this.closeTimeoutSec, this.soLinger, this.tracingEnabled, this.maxHeaderCount, this.trustManagerFactory, this.proxyConfig, this.socksProxyConfig, newValue); } /** * This instance is equal to all instances of {@code ImapClientConfiguration} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(@Nullable Object another) { if (this == another) return true; return another instanceof ImapClientConfiguration && equalTo((ImapClientConfiguration) another); } private boolean equalTo(ImapClientConfiguration another) { return hostAndPort.equals(another.hostAndPort) && authType.equals(another.authType) && useSsl == another.useSsl && noopKeepAliveIntervalSec == another.noopKeepAliveIntervalSec && socketTimeoutMs == another.socketTimeoutMs && writeBackOffMs == another.writeBackOffMs && maxLineLength == another.maxLineLength && defaultResponseBufferSize == another.defaultResponseBufferSize && connectTimeoutMillis == another.connectTimeoutMillis && closeTimeoutSec == another.closeTimeoutSec && soLinger == another.soLinger && tracingEnabled == another.tracingEnabled && maxHeaderCount == another.maxHeaderCount && trustManagerFactory.equals(another.trustManagerFactory) && proxyConfig.equals(another.proxyConfig) && socksProxyConfig.equals(another.socksProxyConfig) && allowedAuthMechanisms.equals(another.allowedAuthMechanisms); } /** * Computes a hash code from attributes: {@code hostAndPort}, {@code authType}, {@code useSsl}, {@code noopKeepAliveIntervalSec}, {@code socketTimeoutMs}, {@code writeBackOffMs}, {@code maxLineLength}, {@code defaultResponseBufferSize}, {@code connectTimeoutMillis}, {@code closeTimeoutSec}, {@code soLinger}, {@code tracingEnabled}, {@code maxHeaderCount}, {@code trustManagerFactory}, {@code proxyConfig}, {@code socksProxyConfig}, {@code allowedAuthMechanisms}. * @return hashCode value */ @Override public int hashCode() { @Var int h = 5381; h += (h << 5) + hostAndPort.hashCode(); h += (h << 5) + authType.hashCode(); h += (h << 5) + Booleans.hashCode(useSsl); h += (h << 5) + noopKeepAliveIntervalSec; h += (h << 5) + socketTimeoutMs; h += (h << 5) + writeBackOffMs; h += (h << 5) + maxLineLength; h += (h << 5) + defaultResponseBufferSize; h += (h << 5) + connectTimeoutMillis; h += (h << 5) + closeTimeoutSec; h += (h << 5) + soLinger; h += (h << 5) + Booleans.hashCode(tracingEnabled); h += (h << 5) + maxHeaderCount; h += (h << 5) + trustManagerFactory.hashCode(); h += (h << 5) + proxyConfig.hashCode(); h += (h << 5) + socksProxyConfig.hashCode(); h += (h << 5) + allowedAuthMechanisms.hashCode(); return h; } /** * Prints the immutable value {@code ImapClientConfiguration} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("ImapClientConfiguration") .omitNullValues() .add("hostAndPort", hostAndPort) .add("authType", authType) .add("useSsl", useSsl) .add("noopKeepAliveIntervalSec", noopKeepAliveIntervalSec) .add("socketTimeoutMs", socketTimeoutMs) .add("writeBackOffMs", writeBackOffMs) .add("maxLineLength", maxLineLength) .add("defaultResponseBufferSize", defaultResponseBufferSize) .add("connectTimeoutMillis", connectTimeoutMillis) .add("closeTimeoutSec", closeTimeoutSec) .add("soLinger", soLinger) .add("tracingEnabled", tracingEnabled) .add("maxHeaderCount", maxHeaderCount) .add("trustManagerFactory", trustManagerFactory) .add("proxyConfig", proxyConfig) .add("socksProxyConfig", socksProxyConfig) .add("allowedAuthMechanisms", allowedAuthMechanisms) .toString(); } /** * Utility type used to correctly read immutable object from JSON representation. * @deprecated Do not use this type directly, it exists only for the Jackson-binding infrastructure */ @Generated(from = "ImapClientConfigurationIF", generator = "Immutables") @Deprecated @SuppressWarnings("Immutable") @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements ImapClientConfigurationIF { @Nullable HostAndPort hostAndPort; boolean useSsl; boolean useSslIsSet; int noopKeepAliveIntervalSec; boolean noopKeepAliveIntervalSecIsSet; int socketTimeoutMs; boolean socketTimeoutMsIsSet; int writeBackOffMs; boolean writeBackOffMsIsSet; int maxLineLength; boolean maxLineLengthIsSet; int defaultResponseBufferSize; boolean defaultResponseBufferSizeIsSet; int connectTimeoutMillis; boolean connectTimeoutMillisIsSet; int closeTimeoutSec; boolean closeTimeoutSecIsSet; int soLinger; boolean soLingerIsSet; boolean tracingEnabled; boolean tracingEnabledIsSet; int maxHeaderCount; boolean maxHeaderCountIsSet; @Nullable Optional trustManagerFactory; @Nullable Optional proxyConfig; @Nullable Optional socksProxyConfig; @Nullable List allowedAuthMechanisms = ImmutableList.of(); boolean allowedAuthMechanismsIsSet; @JsonProperty("hostAndPort") public void setHostAndPort(HostAndPort hostAndPort) { this.hostAndPort = hostAndPort; } @JsonProperty("useSsl") public void setUseSsl(boolean useSsl) { this.useSsl = useSsl; this.useSslIsSet = true; } @JsonProperty("noopKeepAliveIntervalSec") public void setNoopKeepAliveIntervalSec(int noopKeepAliveIntervalSec) { this.noopKeepAliveIntervalSec = noopKeepAliveIntervalSec; this.noopKeepAliveIntervalSecIsSet = true; } @JsonProperty("socketTimeoutMs") public void setSocketTimeoutMs(int socketTimeoutMs) { this.socketTimeoutMs = socketTimeoutMs; this.socketTimeoutMsIsSet = true; } @JsonProperty("writeBackOffMs") public void setWriteBackOffMs(int writeBackOffMs) { this.writeBackOffMs = writeBackOffMs; this.writeBackOffMsIsSet = true; } @JsonProperty("maxLineLength") public void setMaxLineLength(int maxLineLength) { this.maxLineLength = maxLineLength; this.maxLineLengthIsSet = true; } @JsonProperty("defaultResponseBufferSize") public void setDefaultResponseBufferSize(int defaultResponseBufferSize) { this.defaultResponseBufferSize = defaultResponseBufferSize; this.defaultResponseBufferSizeIsSet = true; } @JsonProperty("connectTimeoutMillis") public void setConnectTimeoutMillis(int connectTimeoutMillis) { this.connectTimeoutMillis = connectTimeoutMillis; this.connectTimeoutMillisIsSet = true; } @JsonProperty("closeTimeoutSec") public void setCloseTimeoutSec(int closeTimeoutSec) { this.closeTimeoutSec = closeTimeoutSec; this.closeTimeoutSecIsSet = true; } @JsonProperty("soLinger") public void setSoLinger(int soLinger) { this.soLinger = soLinger; this.soLingerIsSet = true; } @JsonProperty("tracingEnabled") public void setTracingEnabled(boolean tracingEnabled) { this.tracingEnabled = tracingEnabled; this.tracingEnabledIsSet = true; } @JsonProperty("maxHeaderCount") public void setMaxHeaderCount(int maxHeaderCount) { this.maxHeaderCount = maxHeaderCount; this.maxHeaderCountIsSet = true; } @JsonProperty("trustManagerFactory") public void setTrustManagerFactory(Optional trustManagerFactory) { this.trustManagerFactory = trustManagerFactory; } @JsonProperty("proxyConfig") public void setProxyConfig(Optional proxyConfig) { this.proxyConfig = proxyConfig; } @JsonProperty("socksProxyConfig") public void setSocksProxyConfig(Optional socksProxyConfig) { this.socksProxyConfig = socksProxyConfig; } @JsonProperty("allowedAuthMechanisms") public void setAllowedAuthMechanisms(List allowedAuthMechanisms) { this.allowedAuthMechanisms = allowedAuthMechanisms; this.allowedAuthMechanismsIsSet = true; } @Override public HostAndPort hostAndPort() { throw new UnsupportedOperationException(); } @JsonIgnore @Override public AuthMechanism authType() { throw new UnsupportedOperationException(); } @Override public boolean useSsl() { throw new UnsupportedOperationException(); } @Override public int noopKeepAliveIntervalSec() { throw new UnsupportedOperationException(); } @Override public int socketTimeoutMs() { throw new UnsupportedOperationException(); } @Override public int writeBackOffMs() { throw new UnsupportedOperationException(); } @Override public int maxLineLength() { throw new UnsupportedOperationException(); } @Override public int defaultResponseBufferSize() { throw new UnsupportedOperationException(); } @Override public int connectTimeoutMillis() { throw new UnsupportedOperationException(); } @Override public int closeTimeoutSec() { throw new UnsupportedOperationException(); } @Override public int soLinger() { throw new UnsupportedOperationException(); } @Override public boolean tracingEnabled() { throw new UnsupportedOperationException(); } @Override public int maxHeaderCount() { throw new UnsupportedOperationException(); } @Override public Optional trustManagerFactory() { throw new UnsupportedOperationException(); } @Override public Optional proxyConfig() { throw new UnsupportedOperationException(); } @Override public Optional socksProxyConfig() { throw new UnsupportedOperationException(); } @Override public List allowedAuthMechanisms() { throw new UnsupportedOperationException(); } } /** * @param json A JSON-bindable data structure * @return An immutable value type * @deprecated Do not use this method directly, it exists only for the Jackson-binding infrastructure */ @Deprecated @JsonCreator(mode = JsonCreator.Mode.DELEGATING) static ImapClientConfiguration fromJson(Json json) { ImapClientConfiguration.Builder builder = ImapClientConfiguration.builder(); if (json.hostAndPort != null) { builder.hostAndPort(json.hostAndPort); } if (json.useSslIsSet) { builder.useSsl(json.useSsl); } if (json.noopKeepAliveIntervalSecIsSet) { builder.noopKeepAliveIntervalSec(json.noopKeepAliveIntervalSec); } if (json.socketTimeoutMsIsSet) { builder.socketTimeoutMs(json.socketTimeoutMs); } if (json.writeBackOffMsIsSet) { builder.writeBackOffMs(json.writeBackOffMs); } if (json.maxLineLengthIsSet) { builder.maxLineLength(json.maxLineLength); } if (json.defaultResponseBufferSizeIsSet) { builder.defaultResponseBufferSize(json.defaultResponseBufferSize); } if (json.connectTimeoutMillisIsSet) { builder.connectTimeoutMillis(json.connectTimeoutMillis); } if (json.closeTimeoutSecIsSet) { builder.closeTimeoutSec(json.closeTimeoutSec); } if (json.soLingerIsSet) { builder.soLinger(json.soLinger); } if (json.tracingEnabledIsSet) { builder.tracingEnabled(json.tracingEnabled); } if (json.maxHeaderCountIsSet) { builder.maxHeaderCount(json.maxHeaderCount); } if (json.trustManagerFactory != null) { builder.trustManagerFactory(json.trustManagerFactory); } if (json.proxyConfig != null) { builder.proxyConfig(json.proxyConfig); } if (json.socksProxyConfig != null) { builder.socksProxyConfig(json.socksProxyConfig); } if (json.allowedAuthMechanismsIsSet) { builder.addAllAllowedAuthMechanisms(json.allowedAuthMechanisms); } return builder.build(); } /** * Creates an immutable copy of a {@link ImapClientConfigurationIF} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable ImapClientConfiguration instance */ public static ImapClientConfiguration copyOf(ImapClientConfigurationIF instance) { if (instance instanceof ImapClientConfiguration) { return (ImapClientConfiguration) instance; } return ImapClientConfiguration.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImapClientConfiguration ImapClientConfiguration}. *

   * ImapClientConfiguration.builder()
   *    .hostAndPort(com.google.common.net.HostAndPort) // required {@link ImapClientConfigurationIF#hostAndPort() hostAndPort}
   *    .useSsl(boolean) // optional {@link ImapClientConfigurationIF#useSsl() useSsl}
   *    .noopKeepAliveIntervalSec(int) // optional {@link ImapClientConfigurationIF#noopKeepAliveIntervalSec() noopKeepAliveIntervalSec}
   *    .socketTimeoutMs(int) // optional {@link ImapClientConfigurationIF#socketTimeoutMs() socketTimeoutMs}
   *    .writeBackOffMs(int) // optional {@link ImapClientConfigurationIF#writeBackOffMs() writeBackOffMs}
   *    .maxLineLength(int) // optional {@link ImapClientConfigurationIF#maxLineLength() maxLineLength}
   *    .defaultResponseBufferSize(int) // optional {@link ImapClientConfigurationIF#defaultResponseBufferSize() defaultResponseBufferSize}
   *    .connectTimeoutMillis(int) // optional {@link ImapClientConfigurationIF#connectTimeoutMillis() connectTimeoutMillis}
   *    .closeTimeoutSec(int) // optional {@link ImapClientConfigurationIF#closeTimeoutSec() closeTimeoutSec}
   *    .soLinger(int) // optional {@link ImapClientConfigurationIF#soLinger() soLinger}
   *    .tracingEnabled(boolean) // optional {@link ImapClientConfigurationIF#tracingEnabled() tracingEnabled}
   *    .maxHeaderCount(int) // optional {@link ImapClientConfigurationIF#maxHeaderCount() maxHeaderCount}
   *    .trustManagerFactory(Optional&lt;javax.net.ssl.TrustManagerFactory&gt;) // optional {@link ImapClientConfigurationIF#trustManagerFactory() trustManagerFactory}
   *    .proxyConfig(Optional&lt;ProxyConfig&gt;) // optional {@link ImapClientConfigurationIF#proxyConfig() proxyConfig}
   *    .socksProxyConfig(Optional&lt;SocksProxyConfig&gt;) // optional {@link ImapClientConfigurationIF#socksProxyConfig() socksProxyConfig}
   *    .addAllowedAuthMechanisms|addAllAllowedAuthMechanisms(com.hubspot.imap.protocol.capabilities.AuthMechanism) // {@link ImapClientConfigurationIF#allowedAuthMechanisms() allowedAuthMechanisms} elements
   *    .build();
   * 
* @return A new ImapClientConfiguration builder */ public static ImapClientConfiguration.Builder builder() { return new ImapClientConfiguration.Builder(); } /** * Builds instances of type {@link ImapClientConfiguration ImapClientConfiguration}. * Initialize attributes and then invoke the {@link #build()} method to create an * immutable instance. *

{@code Builder} is not thread-safe and generally should not be stored in a field or collection, * but instead used immediately to create instances. */ @Generated(from = "ImapClientConfigurationIF", generator = "Immutables") @NotThreadSafe public static final class Builder { private static final long INIT_BIT_HOST_AND_PORT = 0x1L; private static final long OPT_BIT_USE_SSL = 0x1L; private static final long OPT_BIT_NOOP_KEEP_ALIVE_INTERVAL_SEC = 0x2L; private static final long OPT_BIT_SOCKET_TIMEOUT_MS = 0x4L; private static final long OPT_BIT_WRITE_BACK_OFF_MS = 0x8L; private static final long OPT_BIT_MAX_LINE_LENGTH = 0x10L; private static final long OPT_BIT_DEFAULT_RESPONSE_BUFFER_SIZE = 0x20L; private static final long OPT_BIT_CONNECT_TIMEOUT_MILLIS = 0x40L; private static final long OPT_BIT_CLOSE_TIMEOUT_SEC = 0x80L; private static final long OPT_BIT_SO_LINGER = 0x100L; private static final long OPT_BIT_TRACING_ENABLED = 0x200L; private static final long OPT_BIT_MAX_HEADER_COUNT = 0x400L; private static final long OPT_BIT_ALLOWED_AUTH_MECHANISMS = 0x800L; private long initBits = 0x1L; private long optBits; private @Nullable HostAndPort hostAndPort; private boolean useSsl; private int noopKeepAliveIntervalSec; private int socketTimeoutMs; private int writeBackOffMs; private int maxLineLength; private int defaultResponseBufferSize; private int connectTimeoutMillis; private int closeTimeoutSec; private int soLinger; private boolean tracingEnabled; private int maxHeaderCount; private @Nullable Optional trustManagerFactory; private @Nullable Optional proxyConfig; private @Nullable Optional socksProxyConfig; private ImmutableList.Builder allowedAuthMechanisms = ImmutableList.builder(); private Builder() { } /** * Fill a builder with attribute values from the provided {@code ImapClientConfigurationIF} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * Collection elements and entries will be added, not replaced. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder from(ImapClientConfigurationIF instance) { Objects.requireNonNull(instance, "instance"); hostAndPort(instance.hostAndPort()); useSsl(instance.useSsl()); noopKeepAliveIntervalSec(instance.noopKeepAliveIntervalSec()); socketTimeoutMs(instance.socketTimeoutMs()); writeBackOffMs(instance.writeBackOffMs()); maxLineLength(instance.maxLineLength()); defaultResponseBufferSize(instance.defaultResponseBufferSize()); connectTimeoutMillis(instance.connectTimeoutMillis()); closeTimeoutSec(instance.closeTimeoutSec()); soLinger(instance.soLinger()); tracingEnabled(instance.tracingEnabled()); maxHeaderCount(instance.maxHeaderCount()); trustManagerFactory(instance.trustManagerFactory()); proxyConfig(instance.proxyConfig()); socksProxyConfig(instance.socksProxyConfig()); addAllAllowedAuthMechanisms(instance.allowedAuthMechanisms()); return this; } /** * Initializes the value for the {@link ImapClientConfigurationIF#hostAndPort() hostAndPort} attribute. * @param hostAndPort The value for hostAndPort * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("hostAndPort") public final Builder hostAndPort(HostAndPort hostAndPort) { this.hostAndPort = Objects.requireNonNull(hostAndPort, "hostAndPort"); initBits &= ~INIT_BIT_HOST_AND_PORT; return this; } /** * Initializes the value for the {@link ImapClientConfigurationIF#useSsl() useSsl} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link ImapClientConfigurationIF#useSsl() useSsl}. * @param useSsl The value for useSsl * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("useSsl") public final Builder useSsl(boolean useSsl) { this.useSsl = useSsl; optBits |= OPT_BIT_USE_SSL; return this; } /** * Initializes the value for the {@link ImapClientConfigurationIF#noopKeepAliveIntervalSec() noopKeepAliveIntervalSec} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link ImapClientConfigurationIF#noopKeepAliveIntervalSec() noopKeepAliveIntervalSec}. * @param noopKeepAliveIntervalSec The value for noopKeepAliveIntervalSec * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("noopKeepAliveIntervalSec") public final Builder noopKeepAliveIntervalSec(int noopKeepAliveIntervalSec) { this.noopKeepAliveIntervalSec = noopKeepAliveIntervalSec; optBits |= OPT_BIT_NOOP_KEEP_ALIVE_INTERVAL_SEC; return this; } /** * Initializes the value for the {@link ImapClientConfigurationIF#socketTimeoutMs() socketTimeoutMs} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link ImapClientConfigurationIF#socketTimeoutMs() socketTimeoutMs}. * @param socketTimeoutMs The value for socketTimeoutMs * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("socketTimeoutMs") public final Builder socketTimeoutMs(int socketTimeoutMs) { this.socketTimeoutMs = socketTimeoutMs; optBits |= OPT_BIT_SOCKET_TIMEOUT_MS; return this; } /** * Initializes the value for the {@link ImapClientConfigurationIF#writeBackOffMs() writeBackOffMs} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link ImapClientConfigurationIF#writeBackOffMs() writeBackOffMs}. * @param writeBackOffMs The value for writeBackOffMs * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("writeBackOffMs") public final Builder writeBackOffMs(int writeBackOffMs) { this.writeBackOffMs = writeBackOffMs; optBits |= OPT_BIT_WRITE_BACK_OFF_MS; return this; } /** * Initializes the value for the {@link ImapClientConfigurationIF#maxLineLength() maxLineLength} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link ImapClientConfigurationIF#maxLineLength() maxLineLength}. * @param maxLineLength The value for maxLineLength * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("maxLineLength") public final Builder maxLineLength(int maxLineLength) { this.maxLineLength = maxLineLength; optBits |= OPT_BIT_MAX_LINE_LENGTH; return this; } /** * Initializes the value for the {@link ImapClientConfigurationIF#defaultResponseBufferSize() defaultResponseBufferSize} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link ImapClientConfigurationIF#defaultResponseBufferSize() defaultResponseBufferSize}. * @param defaultResponseBufferSize The value for defaultResponseBufferSize * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("defaultResponseBufferSize") public final Builder defaultResponseBufferSize(int defaultResponseBufferSize) { this.defaultResponseBufferSize = defaultResponseBufferSize; optBits |= OPT_BIT_DEFAULT_RESPONSE_BUFFER_SIZE; return this; } /** * Initializes the value for the {@link ImapClientConfigurationIF#connectTimeoutMillis() connectTimeoutMillis} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link ImapClientConfigurationIF#connectTimeoutMillis() connectTimeoutMillis}. * @param connectTimeoutMillis The value for connectTimeoutMillis * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("connectTimeoutMillis") public final Builder connectTimeoutMillis(int connectTimeoutMillis) { this.connectTimeoutMillis = connectTimeoutMillis; optBits |= OPT_BIT_CONNECT_TIMEOUT_MILLIS; return this; } /** * Initializes the value for the {@link ImapClientConfigurationIF#closeTimeoutSec() closeTimeoutSec} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link ImapClientConfigurationIF#closeTimeoutSec() closeTimeoutSec}. * @param closeTimeoutSec The value for closeTimeoutSec * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("closeTimeoutSec") public final Builder closeTimeoutSec(int closeTimeoutSec) { this.closeTimeoutSec = closeTimeoutSec; optBits |= OPT_BIT_CLOSE_TIMEOUT_SEC; return this; } /** * Initializes the value for the {@link ImapClientConfigurationIF#soLinger() soLinger} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link ImapClientConfigurationIF#soLinger() soLinger}. * @param soLinger The value for soLinger * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("soLinger") public final Builder soLinger(int soLinger) { this.soLinger = soLinger; optBits |= OPT_BIT_SO_LINGER; return this; } /** * Initializes the value for the {@link ImapClientConfigurationIF#tracingEnabled() tracingEnabled} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link ImapClientConfigurationIF#tracingEnabled() tracingEnabled}. * @param tracingEnabled The value for tracingEnabled * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("tracingEnabled") public final Builder tracingEnabled(boolean tracingEnabled) { this.tracingEnabled = tracingEnabled; optBits |= OPT_BIT_TRACING_ENABLED; return this; } /** * Initializes the value for the {@link ImapClientConfigurationIF#maxHeaderCount() maxHeaderCount} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link ImapClientConfigurationIF#maxHeaderCount() maxHeaderCount}. * @param maxHeaderCount The value for maxHeaderCount * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("maxHeaderCount") public final Builder maxHeaderCount(int maxHeaderCount) { this.maxHeaderCount = maxHeaderCount; optBits |= OPT_BIT_MAX_HEADER_COUNT; return this; } /** * Initializes the value for the {@link ImapClientConfigurationIF#trustManagerFactory() trustManagerFactory} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link ImapClientConfigurationIF#trustManagerFactory() trustManagerFactory}. * @param trustManagerFactory The value for trustManagerFactory * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("trustManagerFactory") public final Builder trustManagerFactory(Optional trustManagerFactory) { this.trustManagerFactory = Objects.requireNonNull(trustManagerFactory, "trustManagerFactory"); return this; } /** * Initializes the value for the {@link ImapClientConfigurationIF#proxyConfig() proxyConfig} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link ImapClientConfigurationIF#proxyConfig() proxyConfig}. * @param proxyConfig The value for proxyConfig * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("proxyConfig") public final Builder proxyConfig(Optional proxyConfig) { this.proxyConfig = Objects.requireNonNull(proxyConfig, "proxyConfig"); return this; } /** * Initializes the value for the {@link ImapClientConfigurationIF#socksProxyConfig() socksProxyConfig} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link ImapClientConfigurationIF#socksProxyConfig() socksProxyConfig}. * @param socksProxyConfig The value for socksProxyConfig * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("socksProxyConfig") public final Builder socksProxyConfig(Optional socksProxyConfig) { this.socksProxyConfig = Objects.requireNonNull(socksProxyConfig, "socksProxyConfig"); return this; } /** * Adds one element to {@link ImapClientConfigurationIF#allowedAuthMechanisms() allowedAuthMechanisms} list. * @param element A allowedAuthMechanisms element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addAllowedAuthMechanisms(AuthMechanism element) { this.allowedAuthMechanisms.add(element); optBits |= OPT_BIT_ALLOWED_AUTH_MECHANISMS; return this; } /** * Adds elements to {@link ImapClientConfigurationIF#allowedAuthMechanisms() allowedAuthMechanisms} list. * @param elements An array of allowedAuthMechanisms elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addAllowedAuthMechanisms(AuthMechanism... elements) { this.allowedAuthMechanisms.add(elements); optBits |= OPT_BIT_ALLOWED_AUTH_MECHANISMS; return this; } /** * Sets or replaces all elements for {@link ImapClientConfigurationIF#allowedAuthMechanisms() allowedAuthMechanisms} list. * @param elements An iterable of allowedAuthMechanisms elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("allowedAuthMechanisms") public final Builder allowedAuthMechanisms(Iterable elements) { this.allowedAuthMechanisms = ImmutableList.builder(); return addAllAllowedAuthMechanisms(elements); } /** * Adds elements to {@link ImapClientConfigurationIF#allowedAuthMechanisms() allowedAuthMechanisms} list. * @param elements An iterable of allowedAuthMechanisms elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addAllAllowedAuthMechanisms(Iterable elements) { this.allowedAuthMechanisms.addAll(elements); optBits |= OPT_BIT_ALLOWED_AUTH_MECHANISMS; return this; } /** * Builds a new {@link ImapClientConfiguration ImapClientConfiguration}. * @return An immutable instance of ImapClientConfiguration * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImapClientConfiguration build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImapClientConfiguration(this); } private boolean useSslIsSet() { return (optBits & OPT_BIT_USE_SSL) != 0; } private boolean noopKeepAliveIntervalSecIsSet() { return (optBits & OPT_BIT_NOOP_KEEP_ALIVE_INTERVAL_SEC) != 0; } private boolean socketTimeoutMsIsSet() { return (optBits & OPT_BIT_SOCKET_TIMEOUT_MS) != 0; } private boolean writeBackOffMsIsSet() { return (optBits & OPT_BIT_WRITE_BACK_OFF_MS) != 0; } private boolean maxLineLengthIsSet() { return (optBits & OPT_BIT_MAX_LINE_LENGTH) != 0; } private boolean defaultResponseBufferSizeIsSet() { return (optBits & OPT_BIT_DEFAULT_RESPONSE_BUFFER_SIZE) != 0; } private boolean connectTimeoutMillisIsSet() { return (optBits & OPT_BIT_CONNECT_TIMEOUT_MILLIS) != 0; } private boolean closeTimeoutSecIsSet() { return (optBits & OPT_BIT_CLOSE_TIMEOUT_SEC) != 0; } private boolean soLingerIsSet() { return (optBits & OPT_BIT_SO_LINGER) != 0; } private boolean tracingEnabledIsSet() { return (optBits & OPT_BIT_TRACING_ENABLED) != 0; } private boolean maxHeaderCountIsSet() { return (optBits & OPT_BIT_MAX_HEADER_COUNT) != 0; } private boolean allowedAuthMechanismsIsSet() { return (optBits & OPT_BIT_ALLOWED_AUTH_MECHANISMS) != 0; } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if ((initBits & INIT_BIT_HOST_AND_PORT) != 0) attributes.add("hostAndPort"); return "Cannot build ImapClientConfiguration, some of required attributes are not set " + attributes; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy