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

org.glowroot.ui.ImmutableAdvancedConfigResponse Maven / Gradle / Ivy

There is a newer version: 0.9.28
Show newest version
package org.glowroot.ui;

import org.glowroot.agent.shaded.fasterxml.jackson.annotation.JsonCreator;
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.Lists;
import java.util.List;
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 ConfigJsonService.AdvancedConfigResponse}.
 * 

* Use builder to create immutable instances: * {@code ImmutableAdvancedConfigResponse.builder()}. */ @SuppressWarnings("all") @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "ConfigJsonService.AdvancedConfigResponse"}) @Immutable final class ImmutableAdvancedConfigResponse implements ConfigJsonService.AdvancedConfigResponse { private final ConfigJsonService.AdvancedConfigDto config; private final @Nullable Boolean timerWrapperMethodsActive; private ImmutableAdvancedConfigResponse( ConfigJsonService.AdvancedConfigDto config, @Nullable Boolean timerWrapperMethodsActive) { this.config = config; this.timerWrapperMethodsActive = timerWrapperMethodsActive; } /** * @return value of {@code config} attribute */ @JsonProperty @Override public ConfigJsonService.AdvancedConfigDto config() { return config; } /** * @return value of {@code timerWrapperMethodsActive} attribute */ @JsonProperty @Override public @Nullable Boolean timerWrapperMethodsActive() { return timerWrapperMethodsActive; } /** * Copy current immutable object by setting value for {@link ConfigJsonService.AdvancedConfigResponse#config() config}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for config * @return modified copy of the {@code this} object */ public final ImmutableAdvancedConfigResponse withConfig(ConfigJsonService.AdvancedConfigDto value) { if (this.config == value) return this; ConfigJsonService.AdvancedConfigDto newValue = Preconditions.checkNotNull(value); return new ImmutableAdvancedConfigResponse(newValue, this.timerWrapperMethodsActive); } /** * Copy current immutable object by setting value for {@link ConfigJsonService.AdvancedConfigResponse#timerWrapperMethodsActive() timerWrapperMethodsActive}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for timerWrapperMethodsActive, can be {@code null} * @return modified copy of the {@code this} object */ public final ImmutableAdvancedConfigResponse withTimerWrapperMethodsActive(@Nullable Boolean value) { if (this.timerWrapperMethodsActive == value) return this; @Nullable Boolean newValue = value; return new ImmutableAdvancedConfigResponse(this.config, newValue); } /** * This instance is equal to instances of {@code ImmutableAdvancedConfigResponse} 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 ImmutableAdvancedConfigResponse && equalTo((ImmutableAdvancedConfigResponse) another); } private boolean equalTo(ImmutableAdvancedConfigResponse another) { return config.equals(another.config) && Objects.equal(timerWrapperMethodsActive, another.timerWrapperMethodsActive); } /** * Computes hash code from attributes: {@code config}, {@code timerWrapperMethodsActive}. * @return hashCode value */ @Override public int hashCode() { int h = 31; h = h * 17 + config.hashCode(); h = h * 17 + Objects.hashCode(timerWrapperMethodsActive); return h; } /** * Prints immutable value {@code AdvancedConfigResponse...} with attribute values, * excluding any non-generated and auxiliary attributes. * @return string representation of value */ @Override public String toString() { return MoreObjects.toStringHelper("AdvancedConfigResponse") .add("config", config) .add("timerWrapperMethodsActive", timerWrapperMethodsActive) .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 ConfigJsonService.AdvancedConfigDto config; @JsonProperty @Nullable Boolean timerWrapperMethodsActive; } /** * @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 ImmutableAdvancedConfigResponse fromJson(Json json) { ImmutableAdvancedConfigResponse.Builder builder = ImmutableAdvancedConfigResponse.builder(); if (json.config != null) { builder.config(json.config); } if (json.timerWrapperMethodsActive != null) { builder.timerWrapperMethodsActive(json.timerWrapperMethodsActive); } return builder.build(); } /** * Creates immutable copy of {@link ConfigJsonService.AdvancedConfigResponse}. * 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 AdvancedConfigResponse instance */ static ImmutableAdvancedConfigResponse copyOf(ConfigJsonService.AdvancedConfigResponse instance) { if (instance instanceof ImmutableAdvancedConfigResponse) { return (ImmutableAdvancedConfigResponse) instance; } return ImmutableAdvancedConfigResponse.builder() .copyFrom(instance) .build(); } /** * Creates builder for {@link org.glowroot.ui.ImmutableAdvancedConfigResponse ImmutableAdvancedConfigResponse}. * @return new ImmutableAdvancedConfigResponse builder */ static ImmutableAdvancedConfigResponse.Builder builder() { return new ImmutableAdvancedConfigResponse.Builder(); } /** * Builds instances of {@link org.glowroot.ui.ImmutableAdvancedConfigResponse ImmutableAdvancedConfigResponse}. * 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 static final class Builder { private static final long INIT_BIT_CONFIG = 0x1L; private long initBits = 0x1; private @Nullable ConfigJsonService.AdvancedConfigDto config; private @Nullable Boolean timerWrapperMethodsActive; private Builder() {} /** * Fill builder with attribute values from provided {@link ConfigJsonService.AdvancedConfigResponse} 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(ConfigJsonService.AdvancedConfigResponse instance) { Preconditions.checkNotNull(instance); config(instance.config()); @Nullable Boolean timerWrapperMethodsActiveValue = instance.timerWrapperMethodsActive(); if (timerWrapperMethodsActiveValue != null) { timerWrapperMethodsActive(timerWrapperMethodsActiveValue); } return this; } /** * Initializes value for {@link ConfigJsonService.AdvancedConfigResponse#config() config}. * @param config value for config * @return {@code this} builder for chained invocation */ public final Builder config(ConfigJsonService.AdvancedConfigDto config) { this.config = Preconditions.checkNotNull(config); initBits &= ~INIT_BIT_CONFIG; return this; } /** * Initializes value for {@link ConfigJsonService.AdvancedConfigResponse#timerWrapperMethodsActive() timerWrapperMethodsActive}. * @param timerWrapperMethodsActive value for timerWrapperMethodsActive, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder timerWrapperMethodsActive(@Nullable Boolean timerWrapperMethodsActive) { this.timerWrapperMethodsActive = timerWrapperMethodsActive; return this; } /** * Builds new {@link org.glowroot.ui.ImmutableAdvancedConfigResponse ImmutableAdvancedConfigResponse}. * @return immutable instance of AdvancedConfigResponse * @throws exception {@code java.lang.IllegalStateException} if any required attributes are missing */ public ImmutableAdvancedConfigResponse build() throws IllegalStateException { checkRequiredAttributes(); return new ImmutableAdvancedConfigResponse(config, timerWrapperMethodsActive); } private boolean configIsSet() { return (initBits & INIT_BIT_CONFIG) == 0; } private void checkRequiredAttributes() throws IllegalStateException { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } } private String formatRequiredAttributesMessage() { List attributes = Lists.newArrayList(); if (!configIsSet()) attributes.add("config"); return "Cannot build AdvancedConfigResponse, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy