
org.glowroot.storage.repo.config.ImmutableUserInterfaceConfig 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.Preconditions;
import org.glowroot.agent.shaded.google.common.collect.ImmutableList;
import org.glowroot.agent.shaded.google.common.collect.Lists;
import java.util.ArrayList;
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 UserInterfaceConfig}.
*
* Use builder to create immutable instances:
* {@code ImmutableUserInterfaceConfig.builder()}.
*/
@SuppressWarnings("all")
@ParametersAreNonnullByDefault
@Generated({"Immutables.generator", "UserInterfaceConfig"})
@Immutable
public final class ImmutableUserInterfaceConfig extends UserInterfaceConfig {
private final int port;
private final String defaultDisplayedTransactionType;
private final ImmutableList defaultDisplayedPercentiles;
private final String adminPasswordHash;
private final String readOnlyPasswordHash;
private final UserInterfaceConfig.AnonymousAccess anonymousAccess;
private final int sessionTimeoutMinutes;
private final String version;
private ImmutableUserInterfaceConfig(ImmutableUserInterfaceConfig.Builder builder) {
if (builder.portIsSet()) {
initShim.port(builder.port);
}
if (builder.defaultDisplayedTransactionType != null) {
initShim.defaultDisplayedTransactionType(builder.defaultDisplayedTransactionType);
}
if (builder.defaultDisplayedPercentiles != null) {
initShim.defaultDisplayedPercentiles(builder.defaultDisplayedPercentiles);
}
if (builder.adminPasswordHash != null) {
initShim.adminPasswordHash(builder.adminPasswordHash);
}
if (builder.readOnlyPasswordHash != null) {
initShim.readOnlyPasswordHash(builder.readOnlyPasswordHash);
}
if (builder.anonymousAccess != null) {
initShim.anonymousAccess(builder.anonymousAccess);
}
if (builder.sessionTimeoutMinutesIsSet()) {
initShim.sessionTimeoutMinutes(builder.sessionTimeoutMinutes);
}
this.port = initShim.port();
this.defaultDisplayedTransactionType = initShim.defaultDisplayedTransactionType();
this.defaultDisplayedPercentiles = initShim.defaultDisplayedPercentiles();
this.adminPasswordHash = initShim.adminPasswordHash();
this.readOnlyPasswordHash = initShim.readOnlyPasswordHash();
this.anonymousAccess = initShim.anonymousAccess();
this.sessionTimeoutMinutes = initShim.sessionTimeoutMinutes();
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 int port;
private byte portStage;
int port() {
if (portStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (portStage == STAGE_UNINITIALIZED) {
portStage = STAGE_INITIALIZING;
this.port = ImmutableUserInterfaceConfig.super.port();
portStage = STAGE_INITIALIZED;
}
return port;
}
int port(int value) {
this.port = value;
portStage = STAGE_INITIALIZED;
return value;
}
private String defaultDisplayedTransactionType;
private byte defaultDisplayedTransactionTypeStage;
String defaultDisplayedTransactionType() {
if (defaultDisplayedTransactionTypeStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (defaultDisplayedTransactionTypeStage == STAGE_UNINITIALIZED) {
defaultDisplayedTransactionTypeStage = STAGE_INITIALIZING;
this.defaultDisplayedTransactionType = Preconditions.checkNotNull(ImmutableUserInterfaceConfig.super.defaultDisplayedTransactionType());
defaultDisplayedTransactionTypeStage = STAGE_INITIALIZED;
}
return defaultDisplayedTransactionType;
}
String defaultDisplayedTransactionType(String value) {
this.defaultDisplayedTransactionType = value;
defaultDisplayedTransactionTypeStage = STAGE_INITIALIZED;
return value;
}
private ImmutableList defaultDisplayedPercentiles;
private byte defaultDisplayedPercentilesStage;
ImmutableList defaultDisplayedPercentiles() {
if (defaultDisplayedPercentilesStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (defaultDisplayedPercentilesStage == STAGE_UNINITIALIZED) {
defaultDisplayedPercentilesStage = STAGE_INITIALIZING;
this.defaultDisplayedPercentiles = Preconditions.checkNotNull(ImmutableUserInterfaceConfig.super.defaultDisplayedPercentiles());
defaultDisplayedPercentilesStage = STAGE_INITIALIZED;
}
return defaultDisplayedPercentiles;
}
ImmutableList defaultDisplayedPercentiles(ImmutableList value) {
this.defaultDisplayedPercentiles = value;
defaultDisplayedPercentilesStage = STAGE_INITIALIZED;
return value;
}
private String adminPasswordHash;
private byte adminPasswordHashStage;
String adminPasswordHash() {
if (adminPasswordHashStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (adminPasswordHashStage == STAGE_UNINITIALIZED) {
adminPasswordHashStage = STAGE_INITIALIZING;
this.adminPasswordHash = Preconditions.checkNotNull(ImmutableUserInterfaceConfig.super.adminPasswordHash());
adminPasswordHashStage = STAGE_INITIALIZED;
}
return adminPasswordHash;
}
String adminPasswordHash(String value) {
this.adminPasswordHash = value;
adminPasswordHashStage = STAGE_INITIALIZED;
return value;
}
private String readOnlyPasswordHash;
private byte readOnlyPasswordHashStage;
String readOnlyPasswordHash() {
if (readOnlyPasswordHashStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (readOnlyPasswordHashStage == STAGE_UNINITIALIZED) {
readOnlyPasswordHashStage = STAGE_INITIALIZING;
this.readOnlyPasswordHash = Preconditions.checkNotNull(ImmutableUserInterfaceConfig.super.readOnlyPasswordHash());
readOnlyPasswordHashStage = STAGE_INITIALIZED;
}
return readOnlyPasswordHash;
}
String readOnlyPasswordHash(String value) {
this.readOnlyPasswordHash = value;
readOnlyPasswordHashStage = STAGE_INITIALIZED;
return value;
}
private UserInterfaceConfig.AnonymousAccess anonymousAccess;
private byte anonymousAccessStage;
UserInterfaceConfig.AnonymousAccess anonymousAccess() {
if (anonymousAccessStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (anonymousAccessStage == STAGE_UNINITIALIZED) {
anonymousAccessStage = STAGE_INITIALIZING;
this.anonymousAccess = Preconditions.checkNotNull(ImmutableUserInterfaceConfig.super.anonymousAccess());
anonymousAccessStage = STAGE_INITIALIZED;
}
return anonymousAccess;
}
UserInterfaceConfig.AnonymousAccess anonymousAccess(UserInterfaceConfig.AnonymousAccess value) {
this.anonymousAccess = value;
anonymousAccessStage = STAGE_INITIALIZED;
return value;
}
private int sessionTimeoutMinutes;
private byte sessionTimeoutMinutesStage;
int sessionTimeoutMinutes() {
if (sessionTimeoutMinutesStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (sessionTimeoutMinutesStage == STAGE_UNINITIALIZED) {
sessionTimeoutMinutesStage = STAGE_INITIALIZING;
this.sessionTimeoutMinutes = ImmutableUserInterfaceConfig.super.sessionTimeoutMinutes();
sessionTimeoutMinutesStage = STAGE_INITIALIZED;
}
return sessionTimeoutMinutes;
}
int sessionTimeoutMinutes(int value) {
this.sessionTimeoutMinutes = value;
sessionTimeoutMinutesStage = 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(ImmutableUserInterfaceConfig.super.version());
versionStage = STAGE_INITIALIZED;
}
return version;
}
private String formatInitCycleMessage() {
ArrayList attributes = Lists.newArrayList();;
if (portStage == STAGE_INITIALIZING) attributes.add("port");
if (defaultDisplayedTransactionTypeStage == STAGE_INITIALIZING) attributes.add("defaultDisplayedTransactionType");
if (defaultDisplayedPercentilesStage == STAGE_INITIALIZING) attributes.add("defaultDisplayedPercentiles");
if (adminPasswordHashStage == STAGE_INITIALIZING) attributes.add("adminPasswordHash");
if (readOnlyPasswordHashStage == STAGE_INITIALIZING) attributes.add("readOnlyPasswordHash");
if (anonymousAccessStage == STAGE_INITIALIZING) attributes.add("anonymousAccess");
if (sessionTimeoutMinutesStage == STAGE_INITIALIZING) attributes.add("sessionTimeoutMinutes");
if (versionStage == STAGE_INITIALIZING) attributes.add("version");
return "Cannot build UserInterfaceConfig, attribute initializers form cycle" + attributes;
}
}
private ImmutableUserInterfaceConfig(
int port,
String defaultDisplayedTransactionType,
ImmutableList defaultDisplayedPercentiles,
String adminPasswordHash,
String readOnlyPasswordHash,
UserInterfaceConfig.AnonymousAccess anonymousAccess,
int sessionTimeoutMinutes) {
this.port = port;
this.defaultDisplayedTransactionType = defaultDisplayedTransactionType;
this.defaultDisplayedPercentiles = defaultDisplayedPercentiles;
this.adminPasswordHash = adminPasswordHash;
this.readOnlyPasswordHash = readOnlyPasswordHash;
this.anonymousAccess = anonymousAccess;
this.sessionTimeoutMinutes = sessionTimeoutMinutes;
this.version = Preconditions.checkNotNull(super.version());
this.initShim = null;
}
/**
* @return value of {@code port} attribute
*/
@JsonProperty
@Override
public int port() {
return initShim != null
? initShim.port()
: port;
}
/**
* @return value of {@code defaultDisplayedTransactionType} attribute
*/
@JsonProperty
@Override
public String defaultDisplayedTransactionType() {
return initShim != null
? initShim.defaultDisplayedTransactionType()
: defaultDisplayedTransactionType;
}
/**
* @return value of {@code defaultDisplayedPercentiles} attribute
*/
@JsonProperty
@Override
public ImmutableList defaultDisplayedPercentiles() {
return initShim != null
? initShim.defaultDisplayedPercentiles()
: defaultDisplayedPercentiles;
}
/**
* @return value of {@code adminPasswordHash} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String adminPasswordHash() {
return initShim != null
? initShim.adminPasswordHash()
: adminPasswordHash;
}
/**
* @return value of {@code readOnlyPasswordHash} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String readOnlyPasswordHash() {
return initShim != null
? initShim.readOnlyPasswordHash()
: readOnlyPasswordHash;
}
/**
* @return value of {@code anonymousAccess} attribute
*/
@JsonProperty
@Override
public UserInterfaceConfig.AnonymousAccess anonymousAccess() {
return initShim != null
? initShim.anonymousAccess()
: anonymousAccess;
}
/**
* @return value of {@code sessionTimeoutMinutes} attribute
*/
@JsonProperty
@Override
public int sessionTimeoutMinutes() {
return initShim != null
? initShim.sessionTimeoutMinutes()
: sessionTimeoutMinutes;
}
/**
* @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 UserInterfaceConfig#port() port}.
* Value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value new value for port
* @return modified copy of the {@code this} object
*/
public final ImmutableUserInterfaceConfig withPort(int value) {
if (this.port == value) return this;
int newValue = value;
return new ImmutableUserInterfaceConfig(
newValue,
this.defaultDisplayedTransactionType,
this.defaultDisplayedPercentiles,
this.adminPasswordHash,
this.readOnlyPasswordHash,
this.anonymousAccess,
this.sessionTimeoutMinutes);
}
/**
* Copy current immutable object by setting value for {@link UserInterfaceConfig#defaultDisplayedTransactionType() defaultDisplayedTransactionType}.
* Shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value new value for defaultDisplayedTransactionType
* @return modified copy of the {@code this} object
*/
public final ImmutableUserInterfaceConfig withDefaultDisplayedTransactionType(String value) {
if (this.defaultDisplayedTransactionType == value) return this;
String newValue = Preconditions.checkNotNull(value);
return new ImmutableUserInterfaceConfig(
this.port,
newValue,
this.defaultDisplayedPercentiles,
this.adminPasswordHash,
this.readOnlyPasswordHash,
this.anonymousAccess,
this.sessionTimeoutMinutes);
}
/**
* Copy current immutable object by setting value for {@link UserInterfaceConfig#defaultDisplayedPercentiles() defaultDisplayedPercentiles}.
* Shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value new value for defaultDisplayedPercentiles
* @return modified copy of the {@code this} object
*/
public final ImmutableUserInterfaceConfig withDefaultDisplayedPercentiles(ImmutableList value) {
if (this.defaultDisplayedPercentiles == value) return this;
ImmutableList newValue = Preconditions.checkNotNull(value);
return new ImmutableUserInterfaceConfig(
this.port,
this.defaultDisplayedTransactionType,
newValue,
this.adminPasswordHash,
this.readOnlyPasswordHash,
this.anonymousAccess,
this.sessionTimeoutMinutes);
}
/**
* Copy current immutable object by setting value for {@link UserInterfaceConfig#adminPasswordHash() adminPasswordHash}.
* Shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value new value for adminPasswordHash
* @return modified copy of the {@code this} object
*/
public final ImmutableUserInterfaceConfig withAdminPasswordHash(String value) {
if (this.adminPasswordHash == value) return this;
String newValue = Preconditions.checkNotNull(value);
return new ImmutableUserInterfaceConfig(
this.port,
this.defaultDisplayedTransactionType,
this.defaultDisplayedPercentiles,
newValue,
this.readOnlyPasswordHash,
this.anonymousAccess,
this.sessionTimeoutMinutes);
}
/**
* Copy current immutable object by setting value for {@link UserInterfaceConfig#readOnlyPasswordHash() readOnlyPasswordHash}.
* Shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value new value for readOnlyPasswordHash
* @return modified copy of the {@code this} object
*/
public final ImmutableUserInterfaceConfig withReadOnlyPasswordHash(String value) {
if (this.readOnlyPasswordHash == value) return this;
String newValue = Preconditions.checkNotNull(value);
return new ImmutableUserInterfaceConfig(
this.port,
this.defaultDisplayedTransactionType,
this.defaultDisplayedPercentiles,
this.adminPasswordHash,
newValue,
this.anonymousAccess,
this.sessionTimeoutMinutes);
}
/**
* Copy current immutable object by setting value for {@link UserInterfaceConfig#anonymousAccess() anonymousAccess}.
* Shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value new value for anonymousAccess
* @return modified copy of the {@code this} object
*/
public final ImmutableUserInterfaceConfig withAnonymousAccess(UserInterfaceConfig.AnonymousAccess value) {
if (this.anonymousAccess == value) return this;
UserInterfaceConfig.AnonymousAccess newValue = Preconditions.checkNotNull(value);
return new ImmutableUserInterfaceConfig(
this.port,
this.defaultDisplayedTransactionType,
this.defaultDisplayedPercentiles,
this.adminPasswordHash,
this.readOnlyPasswordHash,
newValue,
this.sessionTimeoutMinutes);
}
/**
* Copy current immutable object by setting value for {@link UserInterfaceConfig#sessionTimeoutMinutes() sessionTimeoutMinutes}.
* Value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value new value for sessionTimeoutMinutes
* @return modified copy of the {@code this} object
*/
public final ImmutableUserInterfaceConfig withSessionTimeoutMinutes(int value) {
if (this.sessionTimeoutMinutes == value) return this;
int newValue = value;
return new ImmutableUserInterfaceConfig(
this.port,
this.defaultDisplayedTransactionType,
this.defaultDisplayedPercentiles,
this.adminPasswordHash,
this.readOnlyPasswordHash,
this.anonymousAccess,
newValue);
}
/**
* This instance is equal to instances of {@code ImmutableUserInterfaceConfig} 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 ImmutableUserInterfaceConfig
&& equalTo((ImmutableUserInterfaceConfig) another);
}
private boolean equalTo(ImmutableUserInterfaceConfig another) {
return port == another.port
&& defaultDisplayedTransactionType.equals(another.defaultDisplayedTransactionType)
&& defaultDisplayedPercentiles.equals(another.defaultDisplayedPercentiles)
&& adminPasswordHash.equals(another.adminPasswordHash)
&& readOnlyPasswordHash.equals(another.readOnlyPasswordHash)
&& anonymousAccess.equals(another.anonymousAccess)
&& sessionTimeoutMinutes == another.sessionTimeoutMinutes
&& version.equals(another.version);
}
/**
* Computes hash code from attributes: {@code port}, {@code defaultDisplayedTransactionType}, {@code defaultDisplayedPercentiles}, {@code adminPasswordHash}, {@code readOnlyPasswordHash}, {@code anonymousAccess}, {@code sessionTimeoutMinutes}, {@code version}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 31;
h = h * 17 + port;
h = h * 17 + defaultDisplayedTransactionType.hashCode();
h = h * 17 + defaultDisplayedPercentiles.hashCode();
h = h * 17 + adminPasswordHash.hashCode();
h = h * 17 + readOnlyPasswordHash.hashCode();
h = h * 17 + anonymousAccess.hashCode();
h = h * 17 + sessionTimeoutMinutes;
h = h * 17 + version.hashCode();
return h;
}
/**
* Prints immutable value {@code UserInterfaceConfig...} with attribute values,
* excluding any non-generated and auxiliary attributes.
* @return string representation of value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("UserInterfaceConfig")
.add("port", port)
.add("defaultDisplayedTransactionType", defaultDisplayedTransactionType)
.add("defaultDisplayedPercentiles", defaultDisplayedPercentiles)
.add("adminPasswordHash", adminPasswordHash)
.add("readOnlyPasswordHash", readOnlyPasswordHash)
.add("anonymousAccess", anonymousAccess)
.add("sessionTimeoutMinutes", sessionTimeoutMinutes)
.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
@Nullable Integer port;
@JsonProperty
@Nullable String defaultDisplayedTransactionType;
@JsonProperty
@Nullable ImmutableList defaultDisplayedPercentiles;
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Nullable String adminPasswordHash;
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Nullable String readOnlyPasswordHash;
@JsonProperty
@Nullable UserInterfaceConfig.AnonymousAccess anonymousAccess;
@JsonProperty
@Nullable Integer sessionTimeoutMinutes;
@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 ImmutableUserInterfaceConfig fromJson(Json json) {
ImmutableUserInterfaceConfig.Builder builder = ImmutableUserInterfaceConfig.builder();
if (json.port != null) {
builder.port(json.port);
}
if (json.defaultDisplayedTransactionType != null) {
builder.defaultDisplayedTransactionType(json.defaultDisplayedTransactionType);
}
if (json.defaultDisplayedPercentiles != null) {
builder.defaultDisplayedPercentiles(json.defaultDisplayedPercentiles);
}
if (json.adminPasswordHash != null) {
builder.adminPasswordHash(json.adminPasswordHash);
}
if (json.readOnlyPasswordHash != null) {
builder.readOnlyPasswordHash(json.readOnlyPasswordHash);
}
if (json.anonymousAccess != null) {
builder.anonymousAccess(json.anonymousAccess);
}
if (json.sessionTimeoutMinutes != null) {
builder.sessionTimeoutMinutes(json.sessionTimeoutMinutes);
}
return builder.build();
}
/**
* Creates immutable copy of {@link UserInterfaceConfig}.
* 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 UserInterfaceConfig instance
*/
public static ImmutableUserInterfaceConfig copyOf(UserInterfaceConfig instance) {
if (instance instanceof ImmutableUserInterfaceConfig) {
return (ImmutableUserInterfaceConfig) instance;
}
return ImmutableUserInterfaceConfig.builder()
.copyFrom(instance)
.build();
}
/**
* Creates builder for {@link org.glowroot.storage.repo.config.ImmutableUserInterfaceConfig ImmutableUserInterfaceConfig}.
* @return new ImmutableUserInterfaceConfig builder
*/
public static ImmutableUserInterfaceConfig.Builder builder() {
return new ImmutableUserInterfaceConfig.Builder();
}
/**
* Builds instances of {@link org.glowroot.storage.repo.config.ImmutableUserInterfaceConfig ImmutableUserInterfaceConfig}.
* 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_PORT = 0x1L;
private static final long OPT_BIT_SESSION_TIMEOUT_MINUTES = 0x2L;
private long optBits;
private int port;
private @Nullable String defaultDisplayedTransactionType;
private @Nullable ImmutableList defaultDisplayedPercentiles;
private @Nullable String adminPasswordHash;
private @Nullable String readOnlyPasswordHash;
private @Nullable UserInterfaceConfig.AnonymousAccess anonymousAccess;
private int sessionTimeoutMinutes;
private Builder() {}
/**
* Fill builder with attribute values from provided {@link UserInterfaceConfig} instance.
* Regular attribute values will be replaced with ones of an instance.
* Instance's absent optional values will not replace present values.
* @param instance instance to copy values from
* @return {@code this} builder for chained invocation
*/
public final Builder copyFrom(UserInterfaceConfig instance) {
Preconditions.checkNotNull(instance);
port(instance.port());
defaultDisplayedTransactionType(instance.defaultDisplayedTransactionType());
defaultDisplayedPercentiles(instance.defaultDisplayedPercentiles());
adminPasswordHash(instance.adminPasswordHash());
readOnlyPasswordHash(instance.readOnlyPasswordHash());
anonymousAccess(instance.anonymousAccess());
sessionTimeoutMinutes(instance.sessionTimeoutMinutes());
return this;
}
/**
* Initializes value for {@link UserInterfaceConfig#port() port}.
* If not set, this attribute will have default value returned by initializer of {@link UserInterfaceConfig#port() port}.
* @param port value for port
* @return {@code this} builder for chained invocation
*/
public final Builder port(int port) {
this.port = port;
optBits |= OPT_BIT_PORT;
return this;
}
/**
* Initializes value for {@link UserInterfaceConfig#defaultDisplayedTransactionType() defaultDisplayedTransactionType}.
*
If not set, this attribute will have default value returned by initializer of {@link UserInterfaceConfig#defaultDisplayedTransactionType() defaultDisplayedTransactionType}.
* @param defaultDisplayedTransactionType value for defaultDisplayedTransactionType
* @return {@code this} builder for chained invocation
*/
public final Builder defaultDisplayedTransactionType(String defaultDisplayedTransactionType) {
this.defaultDisplayedTransactionType = Preconditions.checkNotNull(defaultDisplayedTransactionType);
return this;
}
/**
* Initializes value for {@link UserInterfaceConfig#defaultDisplayedPercentiles() defaultDisplayedPercentiles}.
*
If not set, this attribute will have default value returned by initializer of {@link UserInterfaceConfig#defaultDisplayedPercentiles() defaultDisplayedPercentiles}.
* @param defaultDisplayedPercentiles value for defaultDisplayedPercentiles
* @return {@code this} builder for chained invocation
*/
public final Builder defaultDisplayedPercentiles(ImmutableList defaultDisplayedPercentiles) {
this.defaultDisplayedPercentiles = Preconditions.checkNotNull(defaultDisplayedPercentiles);
return this;
}
/**
* Initializes value for {@link UserInterfaceConfig#adminPasswordHash() adminPasswordHash}.
* If not set, this attribute will have default value returned by initializer of {@link UserInterfaceConfig#adminPasswordHash() adminPasswordHash}.
* @param adminPasswordHash value for adminPasswordHash
* @return {@code this} builder for chained invocation
*/
public final Builder adminPasswordHash(String adminPasswordHash) {
this.adminPasswordHash = Preconditions.checkNotNull(adminPasswordHash);
return this;
}
/**
* Initializes value for {@link UserInterfaceConfig#readOnlyPasswordHash() readOnlyPasswordHash}.
*
If not set, this attribute will have default value returned by initializer of {@link UserInterfaceConfig#readOnlyPasswordHash() readOnlyPasswordHash}.
* @param readOnlyPasswordHash value for readOnlyPasswordHash
* @return {@code this} builder for chained invocation
*/
public final Builder readOnlyPasswordHash(String readOnlyPasswordHash) {
this.readOnlyPasswordHash = Preconditions.checkNotNull(readOnlyPasswordHash);
return this;
}
/**
* Initializes value for {@link UserInterfaceConfig#anonymousAccess() anonymousAccess}.
*
If not set, this attribute will have default value returned by initializer of {@link UserInterfaceConfig#anonymousAccess() anonymousAccess}.
* @param anonymousAccess value for anonymousAccess
* @return {@code this} builder for chained invocation
*/
public final Builder anonymousAccess(UserInterfaceConfig.AnonymousAccess anonymousAccess) {
this.anonymousAccess = Preconditions.checkNotNull(anonymousAccess);
return this;
}
/**
* Initializes value for {@link UserInterfaceConfig#sessionTimeoutMinutes() sessionTimeoutMinutes}.
*
If not set, this attribute will have default value returned by initializer of {@link UserInterfaceConfig#sessionTimeoutMinutes() sessionTimeoutMinutes}.
* @param sessionTimeoutMinutes value for sessionTimeoutMinutes
* @return {@code this} builder for chained invocation
*/
public final Builder sessionTimeoutMinutes(int sessionTimeoutMinutes) {
this.sessionTimeoutMinutes = sessionTimeoutMinutes;
optBits |= OPT_BIT_SESSION_TIMEOUT_MINUTES;
return this;
}
/**
* Builds new {@link org.glowroot.storage.repo.config.ImmutableUserInterfaceConfig ImmutableUserInterfaceConfig}.
* @return immutable instance of UserInterfaceConfig
* @throws exception {@code java.lang.IllegalStateException} if any required attributes are missing
*/
public ImmutableUserInterfaceConfig build()
throws IllegalStateException {
return new ImmutableUserInterfaceConfig(this);
}
private boolean portIsSet() {
return (optBits & OPT_BIT_PORT) != 0;
}
private boolean sessionTimeoutMinutesIsSet() {
return (optBits & OPT_BIT_SESSION_TIMEOUT_MINUTES) != 0;
}
}
}