
org.glowroot.storage.repo.config.ImmutableSmtpConfig Maven / Gradle / Ivy
package org.glowroot.storage.repo.config;
import org.glowroot.agent.shaded.fasterxml.jackson.annotation.JsonCreator;
import org.glowroot.agent.shaded.fasterxml.jackson.annotation.JsonIgnore;
import org.glowroot.agent.shaded.fasterxml.jackson.annotation.JsonInclude;
import org.glowroot.agent.shaded.fasterxml.jackson.annotation.JsonProperty;
import org.glowroot.agent.shaded.google.common.base.MoreObjects;
import org.glowroot.agent.shaded.google.common.base.Objects;
import org.glowroot.agent.shaded.google.common.base.Preconditions;
import org.glowroot.agent.shaded.google.common.collect.ImmutableMap;
import org.glowroot.agent.shaded.google.common.collect.Lists;
import org.glowroot.agent.shaded.google.common.primitives.Booleans;
import java.util.ArrayList;
import java.util.Map;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
/**
* Immutable implementation of {@link SmtpConfig}.
*
* Use builder to create immutable instances:
* {@code ImmutableSmtpConfig.builder()}.
*/
@SuppressWarnings("all")
@ParametersAreNonnullByDefault
@Generated({"Immutables.generator", "SmtpConfig"})
@Immutable
public final class ImmutableSmtpConfig extends SmtpConfig {
private final String fromEmailAddress;
private final String fromDisplayName;
private final String host;
private final @Nullable Integer port;
private final boolean ssl;
private final String username;
private final String encryptedPassword;
private final ImmutableMap additionalProperties;
private final String version;
private ImmutableSmtpConfig(ImmutableSmtpConfig.Builder builder) {
this.port = builder.port;
this.additionalProperties = builder.additionalPropertiesBuilder.build();
if (builder.fromEmailAddress != null) {
initShim.fromEmailAddress(builder.fromEmailAddress);
}
if (builder.fromDisplayName != null) {
initShim.fromDisplayName(builder.fromDisplayName);
}
if (builder.host != null) {
initShim.host(builder.host);
}
if (builder.sslIsSet()) {
initShim.ssl(builder.ssl);
}
if (builder.username != null) {
initShim.username(builder.username);
}
if (builder.encryptedPassword != null) {
initShim.encryptedPassword(builder.encryptedPassword);
}
this.fromEmailAddress = initShim.fromEmailAddress();
this.fromDisplayName = initShim.fromDisplayName();
this.host = initShim.host();
this.ssl = initShim.ssl();
this.username = initShim.username();
this.encryptedPassword = initShim.encryptedPassword();
this.version = Preconditions.checkNotNull(super.version());
this.initShim = null;
}
private static final int STAGE_INITIALIZING = -1;
private static final int STAGE_UNINITIALIZED = 0;
private static final int STAGE_INITIALIZED = 1;
private volatile InitShim initShim = new InitShim();
private final class InitShim {
private String fromEmailAddress;
private byte fromEmailAddressStage;
String fromEmailAddress() {
if (fromEmailAddressStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (fromEmailAddressStage == STAGE_UNINITIALIZED) {
fromEmailAddressStage = STAGE_INITIALIZING;
this.fromEmailAddress = Preconditions.checkNotNull(ImmutableSmtpConfig.super.fromEmailAddress());
fromEmailAddressStage = STAGE_INITIALIZED;
}
return fromEmailAddress;
}
String fromEmailAddress(String value) {
this.fromEmailAddress = value;
fromEmailAddressStage = STAGE_INITIALIZED;
return value;
}
private String fromDisplayName;
private byte fromDisplayNameStage;
String fromDisplayName() {
if (fromDisplayNameStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (fromDisplayNameStage == STAGE_UNINITIALIZED) {
fromDisplayNameStage = STAGE_INITIALIZING;
this.fromDisplayName = Preconditions.checkNotNull(ImmutableSmtpConfig.super.fromDisplayName());
fromDisplayNameStage = STAGE_INITIALIZED;
}
return fromDisplayName;
}
String fromDisplayName(String value) {
this.fromDisplayName = value;
fromDisplayNameStage = STAGE_INITIALIZED;
return value;
}
private String host;
private byte hostStage;
String host() {
if (hostStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (hostStage == STAGE_UNINITIALIZED) {
hostStage = STAGE_INITIALIZING;
this.host = Preconditions.checkNotNull(ImmutableSmtpConfig.super.host());
hostStage = STAGE_INITIALIZED;
}
return host;
}
String host(String value) {
this.host = value;
hostStage = STAGE_INITIALIZED;
return value;
}
private boolean ssl;
private byte sslStage;
boolean ssl() {
if (sslStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (sslStage == STAGE_UNINITIALIZED) {
sslStage = STAGE_INITIALIZING;
this.ssl = ImmutableSmtpConfig.super.ssl();
sslStage = STAGE_INITIALIZED;
}
return ssl;
}
boolean ssl(boolean value) {
this.ssl = value;
sslStage = STAGE_INITIALIZED;
return value;
}
private String username;
private byte usernameStage;
String username() {
if (usernameStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (usernameStage == STAGE_UNINITIALIZED) {
usernameStage = STAGE_INITIALIZING;
this.username = Preconditions.checkNotNull(ImmutableSmtpConfig.super.username());
usernameStage = STAGE_INITIALIZED;
}
return username;
}
String username(String value) {
this.username = value;
usernameStage = STAGE_INITIALIZED;
return value;
}
private String encryptedPassword;
private byte encryptedPasswordStage;
String encryptedPassword() {
if (encryptedPasswordStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (encryptedPasswordStage == STAGE_UNINITIALIZED) {
encryptedPasswordStage = STAGE_INITIALIZING;
this.encryptedPassword = Preconditions.checkNotNull(ImmutableSmtpConfig.super.encryptedPassword());
encryptedPasswordStage = STAGE_INITIALIZED;
}
return encryptedPassword;
}
String encryptedPassword(String value) {
this.encryptedPassword = value;
encryptedPasswordStage = STAGE_INITIALIZED;
return value;
}
private String version;
private byte versionStage;
String version() {
if (versionStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (versionStage == STAGE_UNINITIALIZED) {
versionStage = STAGE_INITIALIZING;
this.version = Preconditions.checkNotNull(ImmutableSmtpConfig.super.version());
versionStage = STAGE_INITIALIZED;
}
return version;
}
private String formatInitCycleMessage() {
ArrayList attributes = Lists.newArrayList();;
if (fromEmailAddressStage == STAGE_INITIALIZING) attributes.add("fromEmailAddress");
if (fromDisplayNameStage == STAGE_INITIALIZING) attributes.add("fromDisplayName");
if (hostStage == STAGE_INITIALIZING) attributes.add("host");
if (sslStage == STAGE_INITIALIZING) attributes.add("ssl");
if (usernameStage == STAGE_INITIALIZING) attributes.add("username");
if (encryptedPasswordStage == STAGE_INITIALIZING) attributes.add("encryptedPassword");
if (versionStage == STAGE_INITIALIZING) attributes.add("version");
return "Cannot build SmtpConfig, attribute initializers form cycle" + attributes;
}
}
private ImmutableSmtpConfig(
String fromEmailAddress,
String fromDisplayName,
String host,
@Nullable Integer port,
boolean ssl,
String username,
String encryptedPassword,
ImmutableMap additionalProperties) {
this.fromEmailAddress = fromEmailAddress;
this.fromDisplayName = fromDisplayName;
this.host = host;
this.port = port;
this.ssl = ssl;
this.username = username;
this.encryptedPassword = encryptedPassword;
this.additionalProperties = additionalProperties;
this.version = Preconditions.checkNotNull(super.version());
this.initShim = null;
}
/**
* @return value of {@code fromEmailAddress} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String fromEmailAddress() {
return initShim != null
? initShim.fromEmailAddress()
: fromEmailAddress;
}
/**
* @return value of {@code fromDisplayName} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String fromDisplayName() {
return initShim != null
? initShim.fromDisplayName()
: fromDisplayName;
}
/**
* @return value of {@code host} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String host() {
return initShim != null
? initShim.host()
: host;
}
/**
* @return value of {@code port} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@Override
public @Nullable Integer port() {
return port;
}
/**
* @return value of {@code ssl} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public boolean ssl() {
return initShim != null
? initShim.ssl()
: ssl;
}
/**
* @return value of {@code username} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String username() {
return initShim != null
? initShim.username()
: username;
}
/**
* @return value of {@code encryptedPassword} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String encryptedPassword() {
return initShim != null
? initShim.encryptedPassword()
: encryptedPassword;
}
/**
* @return value of {@code additionalProperties} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public ImmutableMap additionalProperties() {
return additionalProperties;
}
/**
* @return computed at construction value of {@code version} attribute
*/
@JsonProperty
@JsonIgnore
@Override
public String version() {
return initShim != null
? initShim.version()
: version;
}
/**
* Copy current immutable object by setting value for {@link SmtpConfig#fromEmailAddress() fromEmailAddress}.
* Shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value new value for fromEmailAddress
* @return modified copy of the {@code this} object
*/
public final ImmutableSmtpConfig withFromEmailAddress(String value) {
if (this.fromEmailAddress == value) return this;
String newValue = Preconditions.checkNotNull(value);
return new ImmutableSmtpConfig(
newValue,
this.fromDisplayName,
this.host,
this.port,
this.ssl,
this.username,
this.encryptedPassword,
this.additionalProperties);
}
/**
* Copy current immutable object by setting value for {@link SmtpConfig#fromDisplayName() fromDisplayName}.
* Shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value new value for fromDisplayName
* @return modified copy of the {@code this} object
*/
public final ImmutableSmtpConfig withFromDisplayName(String value) {
if (this.fromDisplayName == value) return this;
String newValue = Preconditions.checkNotNull(value);
return new ImmutableSmtpConfig(
this.fromEmailAddress,
newValue,
this.host,
this.port,
this.ssl,
this.username,
this.encryptedPassword,
this.additionalProperties);
}
/**
* Copy current immutable object by setting value for {@link SmtpConfig#host() host}.
* Shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value new value for host
* @return modified copy of the {@code this} object
*/
public final ImmutableSmtpConfig withHost(String value) {
if (this.host == value) return this;
String newValue = Preconditions.checkNotNull(value);
return new ImmutableSmtpConfig(
this.fromEmailAddress,
this.fromDisplayName,
newValue,
this.port,
this.ssl,
this.username,
this.encryptedPassword,
this.additionalProperties);
}
/**
* Copy current immutable object by setting value for {@link SmtpConfig#port() port}.
* Shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value new value for port, can be {@code null}
* @return modified copy of the {@code this} object
*/
public final ImmutableSmtpConfig withPort(@Nullable Integer value) {
if (this.port == value) return this;
@Nullable Integer newValue = value;
return new ImmutableSmtpConfig(
this.fromEmailAddress,
this.fromDisplayName,
this.host,
newValue,
this.ssl,
this.username,
this.encryptedPassword,
this.additionalProperties);
}
/**
* Copy current immutable object by setting value for {@link SmtpConfig#ssl() ssl}.
* Value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value new value for ssl
* @return modified copy of the {@code this} object
*/
public final ImmutableSmtpConfig withSsl(boolean value) {
if (this.ssl == value) return this;
boolean newValue = value;
return new ImmutableSmtpConfig(
this.fromEmailAddress,
this.fromDisplayName,
this.host,
this.port,
newValue,
this.username,
this.encryptedPassword,
this.additionalProperties);
}
/**
* Copy current immutable object by setting value for {@link SmtpConfig#username() username}.
* Shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value new value for username
* @return modified copy of the {@code this} object
*/
public final ImmutableSmtpConfig withUsername(String value) {
if (this.username == value) return this;
String newValue = Preconditions.checkNotNull(value);
return new ImmutableSmtpConfig(
this.fromEmailAddress,
this.fromDisplayName,
this.host,
this.port,
this.ssl,
newValue,
this.encryptedPassword,
this.additionalProperties);
}
/**
* Copy current immutable object by setting value for {@link SmtpConfig#encryptedPassword() encryptedPassword}.
* Shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value new value for encryptedPassword
* @return modified copy of the {@code this} object
*/
public final ImmutableSmtpConfig withEncryptedPassword(String value) {
if (this.encryptedPassword == value) return this;
String newValue = Preconditions.checkNotNull(value);
return new ImmutableSmtpConfig(
this.fromEmailAddress,
this.fromDisplayName,
this.host,
this.port,
this.ssl,
this.username,
newValue,
this.additionalProperties);
}
/**
* Copy current immutable object by replacing {@link SmtpConfig#additionalProperties() additionalProperties} map with specified map.
* Nulls are not permitted as keys or values.
* Shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param entries to be added to additionalProperties map
* @return modified copy of {@code this} object
*/
public final ImmutableSmtpConfig withAdditionalProperties(Map entries) {
if (this.additionalProperties == entries) return this;
ImmutableMap newValue = ImmutableMap.copyOf(entries);
return new ImmutableSmtpConfig(
this.fromEmailAddress,
this.fromDisplayName,
this.host,
this.port,
this.ssl,
this.username,
this.encryptedPassword,
newValue);
}
/**
* This instance is equal to instances of {@code ImmutableSmtpConfig} with 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 ImmutableSmtpConfig
&& equalTo((ImmutableSmtpConfig) another);
}
private boolean equalTo(ImmutableSmtpConfig another) {
return fromEmailAddress.equals(another.fromEmailAddress)
&& fromDisplayName.equals(another.fromDisplayName)
&& host.equals(another.host)
&& Objects.equal(port, another.port)
&& ssl == another.ssl
&& username.equals(another.username)
&& encryptedPassword.equals(another.encryptedPassword)
&& additionalProperties.equals(another.additionalProperties)
&& version.equals(another.version);
}
/**
* Computes hash code from attributes: {@code fromEmailAddress}, {@code fromDisplayName}, {@code host}, {@code port}, {@code ssl}, {@code username}, {@code encryptedPassword}, {@code additionalProperties}, {@code version}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 31;
h = h * 17 + fromEmailAddress.hashCode();
h = h * 17 + fromDisplayName.hashCode();
h = h * 17 + host.hashCode();
h = h * 17 + Objects.hashCode(port);
h = h * 17 + Booleans.hashCode(ssl);
h = h * 17 + username.hashCode();
h = h * 17 + encryptedPassword.hashCode();
h = h * 17 + additionalProperties.hashCode();
h = h * 17 + version.hashCode();
return h;
}
/**
* Prints immutable value {@code SmtpConfig...} with attribute values,
* excluding any non-generated and auxiliary attributes.
* @return string representation of value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("SmtpConfig")
.add("fromEmailAddress", fromEmailAddress)
.add("fromDisplayName", fromDisplayName)
.add("host", host)
.add("port", port)
.add("ssl", ssl)
.add("username", username)
.add("encryptedPassword", encryptedPassword)
.add("additionalProperties", additionalProperties)
.add("version", version)
.toString();
}
/**
* Simple representation of this value type suitable Jackson binding
* @deprecated Do not use this type directly, it exists only for Jackson-binding infrastructure
*/
@Deprecated
static final class Json {
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Nullable String fromEmailAddress;
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Nullable String fromDisplayName;
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Nullable String host;
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@Nullable Integer port;
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Nullable Boolean ssl;
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Nullable String username;
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Nullable String encryptedPassword;
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Nullable Map additionalProperties;
@JsonProperty
@JsonIgnore
@Nullable String version;
}
/**
* @param json JSON-bindable data structure
* @return immutable value type
* @deprecated Do not use this method directly, it exists only for Jackson-binding infrastructure
*/
@Deprecated
@JsonCreator
static ImmutableSmtpConfig fromJson(Json json) {
ImmutableSmtpConfig.Builder builder = ImmutableSmtpConfig.builder();
if (json.fromEmailAddress != null) {
builder.fromEmailAddress(json.fromEmailAddress);
}
if (json.fromDisplayName != null) {
builder.fromDisplayName(json.fromDisplayName);
}
if (json.host != null) {
builder.host(json.host);
}
if (json.port != null) {
builder.port(json.port);
}
if (json.ssl != null) {
builder.ssl(json.ssl);
}
if (json.username != null) {
builder.username(json.username);
}
if (json.encryptedPassword != null) {
builder.encryptedPassword(json.encryptedPassword);
}
if (json.additionalProperties != null) {
builder.putAllAdditionalProperties(json.additionalProperties);
}
return builder.build();
}
/**
* Creates immutable copy of {@link SmtpConfig}.
* Uses accessors to get values to initialize immutable instance.
* If an instance is already immutable, it is returned as is.
* @param instance instance to copy
* @return copied immutable SmtpConfig instance
*/
public static ImmutableSmtpConfig copyOf(SmtpConfig instance) {
if (instance instanceof ImmutableSmtpConfig) {
return (ImmutableSmtpConfig) instance;
}
return ImmutableSmtpConfig.builder()
.copyFrom(instance)
.build();
}
/**
* Creates builder for {@link org.glowroot.storage.repo.config.ImmutableSmtpConfig ImmutableSmtpConfig}.
* @return new ImmutableSmtpConfig builder
*/
public static ImmutableSmtpConfig.Builder builder() {
return new ImmutableSmtpConfig.Builder();
}
/**
* Builds instances of {@link org.glowroot.storage.repo.config.ImmutableSmtpConfig ImmutableSmtpConfig}.
* Initialize attributes and then invoke {@link #build()} method to create
* immutable instance.
* {@code Builder} is not thread safe and generally should not be stored in field or collection,
* but used immediately to create instances.
*/
@NotThreadSafe
public static final class Builder {
private static final long OPT_BIT_SSL = 0x1L;
private long optBits;
private @Nullable String fromEmailAddress;
private @Nullable String fromDisplayName;
private @Nullable String host;
private @Nullable Integer port;
private boolean ssl;
private @Nullable String username;
private @Nullable String encryptedPassword;
private ImmutableMap.Builder additionalPropertiesBuilder = ImmutableMap.builder();
private Builder() {}
/**
* Fill builder with attribute values from provided {@link SmtpConfig} instance.
* Regular attribute values will be replaced with ones of an instance.
* Instance's absent optional values will not replace present values.
* Collection elements and entries will be added, not replaced.
* @param instance instance to copy values from
* @return {@code this} builder for chained invocation
*/
public final Builder copyFrom(SmtpConfig instance) {
Preconditions.checkNotNull(instance);
fromEmailAddress(instance.fromEmailAddress());
fromDisplayName(instance.fromDisplayName());
host(instance.host());
@Nullable Integer portValue = instance.port();
if (portValue != null) {
port(portValue);
}
ssl(instance.ssl());
username(instance.username());
encryptedPassword(instance.encryptedPassword());
putAllAdditionalProperties(instance.additionalProperties());
return this;
}
/**
* Initializes value for {@link SmtpConfig#fromEmailAddress() fromEmailAddress}.
* If not set, this attribute will have default value returned by initializer of {@link SmtpConfig#fromEmailAddress() fromEmailAddress}.
* @param fromEmailAddress value for fromEmailAddress
* @return {@code this} builder for chained invocation
*/
public final Builder fromEmailAddress(String fromEmailAddress) {
this.fromEmailAddress = Preconditions.checkNotNull(fromEmailAddress);
return this;
}
/**
* Initializes value for {@link SmtpConfig#fromDisplayName() fromDisplayName}.
*
If not set, this attribute will have default value returned by initializer of {@link SmtpConfig#fromDisplayName() fromDisplayName}.
* @param fromDisplayName value for fromDisplayName
* @return {@code this} builder for chained invocation
*/
public final Builder fromDisplayName(String fromDisplayName) {
this.fromDisplayName = Preconditions.checkNotNull(fromDisplayName);
return this;
}
/**
* Initializes value for {@link SmtpConfig#host() host}.
*
If not set, this attribute will have default value returned by initializer of {@link SmtpConfig#host() host}.
* @param host value for host
* @return {@code this} builder for chained invocation
*/
public final Builder host(String host) {
this.host = Preconditions.checkNotNull(host);
return this;
}
/**
* Initializes value for {@link SmtpConfig#port() port}.
* @param port value for port, can be {@code null}
* @return {@code this} builder for chained invocation
*/
public final Builder port(@Nullable Integer port) {
this.port = port;
return this;
}
/**
* Initializes value for {@link SmtpConfig#ssl() ssl}.
*
If not set, this attribute will have default value returned by initializer of {@link SmtpConfig#ssl() ssl}.
* @param ssl value for ssl
* @return {@code this} builder for chained invocation
*/
public final Builder ssl(boolean ssl) {
this.ssl = ssl;
optBits |= OPT_BIT_SSL;
return this;
}
/**
* Initializes value for {@link SmtpConfig#username() username}.
*
If not set, this attribute will have default value returned by initializer of {@link SmtpConfig#username() username}.
* @param username value for username
* @return {@code this} builder for chained invocation
*/
public final Builder username(String username) {
this.username = Preconditions.checkNotNull(username);
return this;
}
/**
* Initializes value for {@link SmtpConfig#encryptedPassword() encryptedPassword}.
*
If not set, this attribute will have default value returned by initializer of {@link SmtpConfig#encryptedPassword() encryptedPassword}.
* @param encryptedPassword value for encryptedPassword
* @return {@code this} builder for chained invocation
*/
public final Builder encryptedPassword(String encryptedPassword) {
this.encryptedPassword = Preconditions.checkNotNull(encryptedPassword);
return this;
}
/**
* Put one entry to {@link SmtpConfig#additionalProperties() additionalProperties} map.
* @param key the key in additionalProperties map
* @param value the associated value in additionalProperties map
* @return {@code this} builder for chained invocation
*/
public final Builder putAdditionalProperties(String key, String value) {
additionalPropertiesBuilder.put(key, value);
return this;
}
/**
* Put one entry to {@link SmtpConfig#additionalProperties() additionalProperties} map. Nulls are not permitted
* @param entry the key and value entry
* @return {@code this} builder for chained invocation
*/
public final Builder putAdditionalProperties(Map.Entry entry) {
additionalPropertiesBuilder.put(entry);
return this;
}
/**
* Sets or replaces all mappings from specified map as entries for {@link SmtpConfig#additionalProperties() additionalProperties} map. Nulls are not permitted
* @param entries to be added to additionalProperties map
* @return {@code this} builder for chained invocation
*/
public final Builder additionalProperties(Map entries) {
additionalPropertiesBuilder = ImmutableMap.builder();
return putAllAdditionalProperties(entries);
}
/**
* Put all mappings from specified map as entries to {@link SmtpConfig#additionalProperties() additionalProperties} map. Nulls are not permitted
* @param entries to be added to additionalProperties map
* @return {@code this} builder for chained invocation
*/
public final Builder putAllAdditionalProperties(Map entries) {
additionalPropertiesBuilder.putAll(entries);
return this;
}
/**
* Builds new {@link org.glowroot.storage.repo.config.ImmutableSmtpConfig ImmutableSmtpConfig}.
* @return immutable instance of SmtpConfig
* @throws exception {@code java.lang.IllegalStateException} if any required attributes are missing
*/
public ImmutableSmtpConfig build()
throws IllegalStateException {
return new ImmutableSmtpConfig(this);
}
private boolean sslIsSet() {
return (optBits & OPT_BIT_SSL) != 0;
}
}
}