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

org.glowroot.ui.ImmutableErrorSummaryRequest 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.Preconditions;
import org.glowroot.agent.shaded.google.common.collect.Lists;
import org.glowroot.agent.shaded.google.common.primitives.Longs;
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;
import org.glowroot.storage.repo.AggregateRepository;

/**
 * Immutable implementation of {@link ErrorJsonService.ErrorSummaryRequest}.
 * 

* Use builder to create immutable instances: * {@code ImmutableErrorSummaryRequest.builder()}. */ @SuppressWarnings("all") @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "ErrorJsonService.ErrorSummaryRequest"}) @Immutable final class ImmutableErrorSummaryRequest implements ErrorJsonService.ErrorSummaryRequest { private final String serverRollup; private final String transactionType; private final long from; private final long to; private final AggregateRepository.ErrorSummarySortOrder sortOrder; private final int limit; private ImmutableErrorSummaryRequest( String serverRollup, String transactionType, long from, long to, AggregateRepository.ErrorSummarySortOrder sortOrder, int limit) { this.serverRollup = serverRollup; this.transactionType = transactionType; this.from = from; this.to = to; this.sortOrder = sortOrder; this.limit = limit; } /** * @return value of {@code serverRollup} attribute */ @JsonProperty @Override public String serverRollup() { return serverRollup; } /** * @return value of {@code transactionType} attribute */ @JsonProperty @Override public String transactionType() { return transactionType; } /** * @return value of {@code from} attribute */ @JsonProperty @Override public long from() { return from; } /** * @return value of {@code to} attribute */ @JsonProperty @Override public long to() { return to; } /** * @return value of {@code sortOrder} attribute */ @JsonProperty @Override public AggregateRepository.ErrorSummarySortOrder sortOrder() { return sortOrder; } /** * @return value of {@code limit} attribute */ @JsonProperty @Override public int limit() { return limit; } /** * Copy current immutable object by setting value for {@link ErrorJsonService.ErrorSummaryRequest#serverRollup() serverRollup}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for serverRollup * @return modified copy of the {@code this} object */ public final ImmutableErrorSummaryRequest withServerRollup(String value) { if (this.serverRollup == value) return this; String newValue = Preconditions.checkNotNull(value); return new ImmutableErrorSummaryRequest(newValue, this.transactionType, this.from, this.to, this.sortOrder, this.limit); } /** * Copy current immutable object by setting value for {@link ErrorJsonService.ErrorSummaryRequest#transactionType() transactionType}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for transactionType * @return modified copy of the {@code this} object */ public final ImmutableErrorSummaryRequest withTransactionType(String value) { if (this.transactionType == value) return this; String newValue = Preconditions.checkNotNull(value); return new ImmutableErrorSummaryRequest(this.serverRollup, newValue, this.from, this.to, this.sortOrder, this.limit); } /** * Copy current immutable object by setting value for {@link ErrorJsonService.ErrorSummaryRequest#from() from}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for from * @return modified copy of the {@code this} object */ public final ImmutableErrorSummaryRequest withFrom(long value) { if (this.from == value) return this; long newValue = value; return new ImmutableErrorSummaryRequest(this.serverRollup, this.transactionType, newValue, this.to, this.sortOrder, this.limit); } /** * Copy current immutable object by setting value for {@link ErrorJsonService.ErrorSummaryRequest#to() to}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for to * @return modified copy of the {@code this} object */ public final ImmutableErrorSummaryRequest withTo(long value) { if (this.to == value) return this; long newValue = value; return new ImmutableErrorSummaryRequest(this.serverRollup, this.transactionType, this.from, newValue, this.sortOrder, this.limit); } /** * Copy current immutable object by setting value for {@link ErrorJsonService.ErrorSummaryRequest#sortOrder() sortOrder}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for sortOrder * @return modified copy of the {@code this} object */ public final ImmutableErrorSummaryRequest withSortOrder(AggregateRepository.ErrorSummarySortOrder value) { if (this.sortOrder == value) return this; AggregateRepository.ErrorSummarySortOrder newValue = Preconditions.checkNotNull(value); return new ImmutableErrorSummaryRequest(this.serverRollup, this.transactionType, this.from, this.to, newValue, this.limit); } /** * Copy current immutable object by setting value for {@link ErrorJsonService.ErrorSummaryRequest#limit() limit}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for limit * @return modified copy of the {@code this} object */ public final ImmutableErrorSummaryRequest withLimit(int value) { if (this.limit == value) return this; int newValue = value; return new ImmutableErrorSummaryRequest(this.serverRollup, this.transactionType, this.from, this.to, this.sortOrder, newValue); } /** * This instance is equal to instances of {@code ImmutableErrorSummaryRequest} 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 ImmutableErrorSummaryRequest && equalTo((ImmutableErrorSummaryRequest) another); } private boolean equalTo(ImmutableErrorSummaryRequest another) { return serverRollup.equals(another.serverRollup) && transactionType.equals(another.transactionType) && from == another.from && to == another.to && sortOrder.equals(another.sortOrder) && limit == another.limit; } /** * Computes hash code from attributes: {@code serverRollup}, {@code transactionType}, {@code from}, {@code to}, {@code sortOrder}, {@code limit}. * @return hashCode value */ @Override public int hashCode() { int h = 31; h = h * 17 + serverRollup.hashCode(); h = h * 17 + transactionType.hashCode(); h = h * 17 + Longs.hashCode(from); h = h * 17 + Longs.hashCode(to); h = h * 17 + sortOrder.hashCode(); h = h * 17 + limit; return h; } /** * Prints immutable value {@code ErrorSummaryRequest...} with attribute values, * excluding any non-generated and auxiliary attributes. * @return string representation of value */ @Override public String toString() { return MoreObjects.toStringHelper("ErrorSummaryRequest") .add("serverRollup", serverRollup) .add("transactionType", transactionType) .add("from", from) .add("to", to) .add("sortOrder", sortOrder) .add("limit", limit) .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 String serverRollup; @JsonProperty @Nullable String transactionType; @JsonProperty @Nullable Long from; @JsonProperty @Nullable Long to; @JsonProperty @Nullable AggregateRepository.ErrorSummarySortOrder sortOrder; @JsonProperty @Nullable Integer limit; } /** * @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 ImmutableErrorSummaryRequest fromJson(Json json) { ImmutableErrorSummaryRequest.Builder builder = ImmutableErrorSummaryRequest.builder(); if (json.serverRollup != null) { builder.serverRollup(json.serverRollup); } if (json.transactionType != null) { builder.transactionType(json.transactionType); } if (json.from != null) { builder.from(json.from); } if (json.to != null) { builder.to(json.to); } if (json.sortOrder != null) { builder.sortOrder(json.sortOrder); } if (json.limit != null) { builder.limit(json.limit); } return builder.build(); } /** * Creates immutable copy of {@link ErrorJsonService.ErrorSummaryRequest}. * 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 ErrorSummaryRequest instance */ static ImmutableErrorSummaryRequest copyOf(ErrorJsonService.ErrorSummaryRequest instance) { if (instance instanceof ImmutableErrorSummaryRequest) { return (ImmutableErrorSummaryRequest) instance; } return ImmutableErrorSummaryRequest.builder() .copyFrom(instance) .build(); } /** * Creates builder for {@link org.glowroot.ui.ImmutableErrorSummaryRequest ImmutableErrorSummaryRequest}. * @return new ImmutableErrorSummaryRequest builder */ static ImmutableErrorSummaryRequest.Builder builder() { return new ImmutableErrorSummaryRequest.Builder(); } /** * Builds instances of {@link org.glowroot.ui.ImmutableErrorSummaryRequest ImmutableErrorSummaryRequest}. * 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_SERVER_ROLLUP = 0x1L; private static final long INIT_BIT_TRANSACTION_TYPE = 0x2L; private static final long INIT_BIT_FROM = 0x4L; private static final long INIT_BIT_TO = 0x8L; private static final long INIT_BIT_SORT_ORDER = 0x10L; private static final long INIT_BIT_LIMIT = 0x20L; private long initBits = 0x3f; private @Nullable String serverRollup; private @Nullable String transactionType; private long from; private long to; private @Nullable AggregateRepository.ErrorSummarySortOrder sortOrder; private int limit; private Builder() {} /** * Fill builder with attribute values from provided {@link ErrorJsonService.ErrorSummaryRequest} 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(ErrorJsonService.ErrorSummaryRequest instance) { Preconditions.checkNotNull(instance); serverRollup(instance.serverRollup()); transactionType(instance.transactionType()); from(instance.from()); to(instance.to()); sortOrder(instance.sortOrder()); limit(instance.limit()); return this; } /** * Initializes value for {@link ErrorJsonService.ErrorSummaryRequest#serverRollup() serverRollup}. * @param serverRollup value for serverRollup * @return {@code this} builder for chained invocation */ public final Builder serverRollup(String serverRollup) { this.serverRollup = Preconditions.checkNotNull(serverRollup); initBits &= ~INIT_BIT_SERVER_ROLLUP; return this; } /** * Initializes value for {@link ErrorJsonService.ErrorSummaryRequest#transactionType() transactionType}. * @param transactionType value for transactionType * @return {@code this} builder for chained invocation */ public final Builder transactionType(String transactionType) { this.transactionType = Preconditions.checkNotNull(transactionType); initBits &= ~INIT_BIT_TRANSACTION_TYPE; return this; } /** * Initializes value for {@link ErrorJsonService.ErrorSummaryRequest#from() from}. * @param from value for from * @return {@code this} builder for chained invocation */ public final Builder from(long from) { this.from = from; initBits &= ~INIT_BIT_FROM; return this; } /** * Initializes value for {@link ErrorJsonService.ErrorSummaryRequest#to() to}. * @param to value for to * @return {@code this} builder for chained invocation */ public final Builder to(long to) { this.to = to; initBits &= ~INIT_BIT_TO; return this; } /** * Initializes value for {@link ErrorJsonService.ErrorSummaryRequest#sortOrder() sortOrder}. * @param sortOrder value for sortOrder * @return {@code this} builder for chained invocation */ public final Builder sortOrder(AggregateRepository.ErrorSummarySortOrder sortOrder) { this.sortOrder = Preconditions.checkNotNull(sortOrder); initBits &= ~INIT_BIT_SORT_ORDER; return this; } /** * Initializes value for {@link ErrorJsonService.ErrorSummaryRequest#limit() limit}. * @param limit value for limit * @return {@code this} builder for chained invocation */ public final Builder limit(int limit) { this.limit = limit; initBits &= ~INIT_BIT_LIMIT; return this; } /** * Builds new {@link org.glowroot.ui.ImmutableErrorSummaryRequest ImmutableErrorSummaryRequest}. * @return immutable instance of ErrorSummaryRequest * @throws exception {@code java.lang.IllegalStateException} if any required attributes are missing */ public ImmutableErrorSummaryRequest build() throws IllegalStateException { checkRequiredAttributes(); return new ImmutableErrorSummaryRequest(serverRollup, transactionType, from, to, sortOrder, limit); } private boolean serverRollupIsSet() { return (initBits & INIT_BIT_SERVER_ROLLUP) == 0; } private boolean transactionTypeIsSet() { return (initBits & INIT_BIT_TRANSACTION_TYPE) == 0; } private boolean fromIsSet() { return (initBits & INIT_BIT_FROM) == 0; } private boolean toIsSet() { return (initBits & INIT_BIT_TO) == 0; } private boolean sortOrderIsSet() { return (initBits & INIT_BIT_SORT_ORDER) == 0; } private boolean limitIsSet() { return (initBits & INIT_BIT_LIMIT) == 0; } private void checkRequiredAttributes() throws IllegalStateException { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } } private String formatRequiredAttributesMessage() { List attributes = Lists.newArrayList(); if (!serverRollupIsSet()) attributes.add("serverRollup"); if (!transactionTypeIsSet()) attributes.add("transactionType"); if (!fromIsSet()) attributes.add("from"); if (!toIsSet()) attributes.add("to"); if (!sortOrderIsSet()) attributes.add("sortOrder"); if (!limitIsSet()) attributes.add("limit"); return "Cannot build ErrorSummaryRequest, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy