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

com.treasuredata.client.model.ImmutableTDSavedQueryStartRequestV4 Maven / Gradle / Ivy

There is a newer version: 1.1.1
Show newest version
package com.treasuredata.client.model;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.common.base.MoreObjects;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.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 TDSavedQueryStartRequestV4}.
 * 

* Use the builder to create immutable instances: * {@code ImmutableTDSavedQueryStartRequestV4.builder()}. */ @SuppressWarnings("all") @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "TDSavedQueryStartRequestV4"}) @Immutable final class ImmutableTDSavedQueryStartRequestV4 extends TDSavedQueryStartRequestV4 { private final String scheduledTime; private final Optional domainKey; private ImmutableTDSavedQueryStartRequestV4(String scheduledTime, Optional domainKey) { this.scheduledTime = scheduledTime; this.domainKey = domainKey; } /** * @return The value of the {@code scheduledTime} attribute */ @JsonProperty("scheduled_time") @Override public String scheduledTime() { return scheduledTime; } /** * @return The value of the {@code domainKey} attribute */ @JsonProperty("domain_key") @Override public Optional domainKey() { return domainKey; } /** * Copy the current immutable object by setting a value for the {@link TDSavedQueryStartRequestV4#scheduledTime() scheduledTime} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param scheduledTime A new value for scheduledTime * @return A modified copy of the {@code this} object */ public final ImmutableTDSavedQueryStartRequestV4 withScheduledTime(String scheduledTime) { if (this.scheduledTime.equals(scheduledTime)) return this; String newValue = Preconditions.checkNotNull(scheduledTime, "scheduledTime"); return new ImmutableTDSavedQueryStartRequestV4(newValue, this.domainKey); } /** * Copy the current immutable object by setting a present value for the optional {@link TDSavedQueryStartRequestV4#domainKey() domainKey} attribute. * @param value The value for domainKey * @return A modified copy of {@code this} object */ public final ImmutableTDSavedQueryStartRequestV4 withDomainKey(String value) { Optional newValue = Optional.of(value); if (this.domainKey.equals(newValue)) return this; return new ImmutableTDSavedQueryStartRequestV4(this.scheduledTime, newValue); } /** * Copy the current immutable object by setting an optional value for the {@link TDSavedQueryStartRequestV4#domainKey() domainKey} attribute. * An equality check is used to prevent copying of the same value by returning {@code this}. * @param optional A value for domainKey * @return A modified copy of {@code this} object */ public final ImmutableTDSavedQueryStartRequestV4 withDomainKey(Optional optional) { Optional value = Preconditions.checkNotNull(optional, "domainKey"); if (this.domainKey.equals(value)) return this; return new ImmutableTDSavedQueryStartRequestV4(this.scheduledTime, value); } /** * This instance is equal to all instances of {@code ImmutableTDSavedQueryStartRequestV4} 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 ImmutableTDSavedQueryStartRequestV4 && equalTo((ImmutableTDSavedQueryStartRequestV4) another); } private boolean equalTo(ImmutableTDSavedQueryStartRequestV4 another) { return scheduledTime.equals(another.scheduledTime) && domainKey.equals(another.domainKey); } /** * Computes a hash code from attributes: {@code scheduledTime}, {@code domainKey}. * @return hashCode value */ @Override public int hashCode() { int h = 31; h = h * 17 + scheduledTime.hashCode(); h = h * 17 + domainKey.hashCode(); return h; } /** * Prints the immutable value {@code TDSavedQueryStartRequestV4} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("TDSavedQueryStartRequestV4") .omitNullValues() .add("scheduledTime", scheduledTime) .add("domainKey", domainKey.orNull()) .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 */ @Deprecated @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json extends TDSavedQueryStartRequestV4 { @Nullable String scheduledTime; Optional domainKey = Optional.absent(); @JsonProperty("scheduled_time") public void setScheduledTime(String scheduledTime) { this.scheduledTime = scheduledTime; } @JsonProperty("domain_key") public void setDomainKey(Optional domainKey) { this.domainKey = domainKey; } @Override public String scheduledTime() { throw new UnsupportedOperationException(); } @Override public Optional domainKey() { 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 static ImmutableTDSavedQueryStartRequestV4 fromJson(Json json) { ImmutableTDSavedQueryStartRequestV4.Builder builder = ImmutableTDSavedQueryStartRequestV4.builder(); if (json.scheduledTime != null) { builder.scheduledTime(json.scheduledTime); } if (json.domainKey != null) { builder.domainKey(json.domainKey); } return builder.build(); } /** * Creates an immutable copy of a {@link TDSavedQueryStartRequestV4} 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 TDSavedQueryStartRequestV4 instance */ public static ImmutableTDSavedQueryStartRequestV4 copyOf(TDSavedQueryStartRequestV4 instance) { if (instance instanceof ImmutableTDSavedQueryStartRequestV4) { return (ImmutableTDSavedQueryStartRequestV4) instance; } return ImmutableTDSavedQueryStartRequestV4.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableTDSavedQueryStartRequestV4 ImmutableTDSavedQueryStartRequestV4}. * @return A new ImmutableTDSavedQueryStartRequestV4 builder */ public static ImmutableTDSavedQueryStartRequestV4.Builder builder() { return new ImmutableTDSavedQueryStartRequestV4.Builder(); } /** * Builds instances of type {@link ImmutableTDSavedQueryStartRequestV4 ImmutableTDSavedQueryStartRequestV4}. * 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. */ @NotThreadSafe static final class Builder implements TDSavedQueryStartRequestV4.Builder { private static final long INIT_BIT_SCHEDULED_TIME = 0x1L; private long initBits = 0x1L; private @Nullable String scheduledTime; private Optional domainKey = Optional.absent(); private Builder() { } /** * Fill a builder with attribute values from the provided {@code TDSavedQueryStartRequestV4} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(TDSavedQueryStartRequestV4 instance) { Preconditions.checkNotNull(instance, "instance"); scheduledTime(instance.scheduledTime()); Optional domainKeyOptional = instance.domainKey(); if (domainKeyOptional.isPresent()) { domainKey(domainKeyOptional); } return this; } /** * Initializes the value for the {@link TDSavedQueryStartRequestV4#scheduledTime() scheduledTime} attribute. * @param scheduledTime The value for scheduledTime * @return {@code this} builder for use in a chained invocation */ public final Builder scheduledTime(String scheduledTime) { this.scheduledTime = Preconditions.checkNotNull(scheduledTime, "scheduledTime"); initBits &= ~INIT_BIT_SCHEDULED_TIME; return this; } /** * Initializes the optional value {@link TDSavedQueryStartRequestV4#domainKey() domainKey} to domainKey. * @param domainKey The value for domainKey * @return {@code this} builder for chained invocation */ public final Builder domainKey(String domainKey) { this.domainKey = Optional.of(domainKey); return this; } /** * Initializes the optional value {@link TDSavedQueryStartRequestV4#domainKey() domainKey} to domainKey. * @param domainKey The value for domainKey * @return {@code this} builder for use in a chained invocation */ public final Builder domainKey(Optional domainKey) { this.domainKey = Preconditions.checkNotNull(domainKey, "domainKey"); return this; } /** * Builds a new {@link ImmutableTDSavedQueryStartRequestV4 ImmutableTDSavedQueryStartRequestV4}. * @return An immutable instance of TDSavedQueryStartRequestV4 * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableTDSavedQueryStartRequestV4 build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableTDSavedQueryStartRequestV4(scheduledTime, domainKey); } private String formatRequiredAttributesMessage() { List attributes = Lists.newArrayList(); if ((initBits & INIT_BIT_SCHEDULED_TIME) != 0) attributes.add("scheduledTime"); return "Cannot build TDSavedQueryStartRequestV4, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy