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

org.immutables.fixture.ImmutableNoOriginalFieldCopyMethodConflict Maven / Gradle / Ivy

package org.immutables.fixture;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
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 NoOriginalFieldCopyMethodConflict}.
 * 

* Use the builder to create immutable instances: * {@code ImmutableNoOriginalFieldCopyMethodConflict.builder()}. * Use the static factory method to create immutable instances: * {@code ImmutableNoOriginalFieldCopyMethodConflict.of()}. */ @SuppressWarnings("all") @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "NoOriginalFieldCopyMethodConflict"}) @Immutable final class ImmutableNoOriginalFieldCopyMethodConflict implements NoOriginalFieldCopyMethodConflict { private final int original; private final @Nullable Integer hh; private final ImmutableList a; private ImmutableNoOriginalFieldCopyMethodConflict(int original, @Nullable Integer hh, Iterable a) { this.original = original; this.hh = hh; this.a = ImmutableList.copyOf(a); } private ImmutableNoOriginalFieldCopyMethodConflict( ImmutableNoOriginalFieldCopyMethodConflict original$$, int original, @Nullable Integer hh, ImmutableList a) { this.original = original; this.hh = hh; this.a = a; } /** * @return The value of the {@code original} attribute */ @Override public int original() { return original; } /** * @return The value of the {@code hh} attribute */ @Override public @Nullable Integer hh() { return hh; } /** * @return The value of the {@code a} attribute */ @Override public ImmutableList a() { return a; } /** * Copy the current immutable object by setting a value for the {@link NoOriginalFieldCopyMethodConflict#original() original} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param original A new value for original * @return A modified copy of the {@code this} object */ public final ImmutableNoOriginalFieldCopyMethodConflict withOriginal(int original) { if (this.original == original) return this; return new ImmutableNoOriginalFieldCopyMethodConflict(this, original, this.hh, this.a); } /** * Copy the current immutable object by setting a value for the {@link NoOriginalFieldCopyMethodConflict#hh() hh} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param hh A new value for hh (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableNoOriginalFieldCopyMethodConflict withHh(@Nullable Integer hh) { if (Objects.equal(this.hh, hh)) return this; return new ImmutableNoOriginalFieldCopyMethodConflict(this, this.original, hh, this.a); } /** * Copy the current immutable object with elements that replace the content of {@link NoOriginalFieldCopyMethodConflict#a() a}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableNoOriginalFieldCopyMethodConflict withA(String... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableNoOriginalFieldCopyMethodConflict(this, this.original, this.hh, newValue); } /** * Copy the current immutable object with elements that replace the content of {@link NoOriginalFieldCopyMethodConflict#a() a}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of a elements to set * @return A modified copy of {@code this} object */ public final ImmutableNoOriginalFieldCopyMethodConflict withA(Iterable elements) { if (this.a == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableNoOriginalFieldCopyMethodConflict(this, this.original, this.hh, newValue); } /** * This instance is equal to all instances of {@code ImmutableNoOriginalFieldCopyMethodConflict} 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 ImmutableNoOriginalFieldCopyMethodConflict && equalTo((ImmutableNoOriginalFieldCopyMethodConflict) another); } private boolean equalTo(ImmutableNoOriginalFieldCopyMethodConflict another) { return original == another.original && Objects.equal(hh, another.hh) && a.equals(another.a); } /** * Computes a hash code from attributes: {@code original}, {@code hh}, {@code a}. * @return hashCode value */ @Override public int hashCode() { int h = 31; h = h * 17 + original; h = h * 17 + Objects.hashCode(hh); h = h * 17 + a.hashCode(); return h; } /** * Prints the immutable value {@code NoOriginalFieldCopyMethodConflict} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("NoOriginalFieldCopyMethodConflict") .omitNullValues() .add("original", original) .add("hh", hh) .add("a", a) .toString(); } /** * Construct a new immutable {@code NoOriginalFieldCopyMethodConflict} instance. * @param original The value for the {@code original} attribute * @param hh The value for the {@code hh} attribute * @param a The value for the {@code a} attribute * @return An immutable NoOriginalFieldCopyMethodConflict instance */ public static ImmutableNoOriginalFieldCopyMethodConflict of(int original, @Nullable Integer hh, List a) { return of(original, hh, (Iterable) a); } /** * Construct a new immutable {@code NoOriginalFieldCopyMethodConflict} instance. * @param original The value for the {@code original} attribute * @param hh The value for the {@code hh} attribute * @param a The value for the {@code a} attribute * @return An immutable NoOriginalFieldCopyMethodConflict instance */ public static ImmutableNoOriginalFieldCopyMethodConflict of(int original, @Nullable Integer hh, Iterable a) { return new ImmutableNoOriginalFieldCopyMethodConflict(original, hh, a); } /** * Creates an immutable copy of a {@link NoOriginalFieldCopyMethodConflict} 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 NoOriginalFieldCopyMethodConflict instance */ public static ImmutableNoOriginalFieldCopyMethodConflict copyOf(NoOriginalFieldCopyMethodConflict instance) { if (instance instanceof ImmutableNoOriginalFieldCopyMethodConflict) { return (ImmutableNoOriginalFieldCopyMethodConflict) instance; } return ImmutableNoOriginalFieldCopyMethodConflict.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableNoOriginalFieldCopyMethodConflict ImmutableNoOriginalFieldCopyMethodConflict}. * @return A new ImmutableNoOriginalFieldCopyMethodConflict builder */ public static ImmutableNoOriginalFieldCopyMethodConflict.Builder builder() { return new ImmutableNoOriginalFieldCopyMethodConflict.Builder(); } /** * Builds instances of type {@link ImmutableNoOriginalFieldCopyMethodConflict ImmutableNoOriginalFieldCopyMethodConflict}. * 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 { private static final long INIT_BIT_ORIGINAL = 0x1L; private long initBits = 0x1L; private int original; private @Nullable Integer hh; private ImmutableList.Builder a = ImmutableList.builder(); private Builder() { } /** * Fill a builder with attribute values from the provided {@code NoOriginalFieldCopyMethodConflict} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * Collection elements and entries will be added, not replaced. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(NoOriginalFieldCopyMethodConflict instance) { Preconditions.checkNotNull(instance, "instance"); original(instance.original()); @Nullable Integer hhValue = instance.hh(); if (hhValue != null) { hh(hhValue); } addAllA(instance.a()); return this; } /** * Initializes the value for the {@link NoOriginalFieldCopyMethodConflict#original() original} attribute. * @param original The value for original * @return {@code this} builder for use in a chained invocation */ public final Builder original(int original) { this.original = original; initBits &= ~INIT_BIT_ORIGINAL; return this; } /** * Initializes the value for the {@link NoOriginalFieldCopyMethodConflict#hh() hh} attribute. * @param hh The value for hh (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ public final Builder hh(@Nullable Integer hh) { this.hh = hh; return this; } /** * Adds one element to {@link NoOriginalFieldCopyMethodConflict#a() a} list. * @param element A a element * @return {@code this} builder for use in a chained invocation */ public final Builder addA(String element) { this.a.add(element); return this; } /** * Adds elements to {@link NoOriginalFieldCopyMethodConflict#a() a} list. * @param elements An array of a elements * @return {@code this} builder for use in a chained invocation */ public final Builder addA(String... elements) { this.a.add(elements); return this; } /** * Sets or replaces all elements for {@link NoOriginalFieldCopyMethodConflict#a() a} list. * @param elements An iterable of a elements * @return {@code this} builder for use in a chained invocation */ public final Builder a(Iterable elements) { this.a = ImmutableList.builder(); return addAllA(elements); } /** * Adds elements to {@link NoOriginalFieldCopyMethodConflict#a() a} list. * @param elements An iterable of a elements * @return {@code this} builder for use in a chained invocation */ public final Builder addAllA(Iterable elements) { this.a.addAll(elements); return this; } /** * Builds a new {@link ImmutableNoOriginalFieldCopyMethodConflict ImmutableNoOriginalFieldCopyMethodConflict}. * @return An immutable instance of NoOriginalFieldCopyMethodConflict * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableNoOriginalFieldCopyMethodConflict build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableNoOriginalFieldCopyMethodConflict(null, original, hh, a.build()); } private String formatRequiredAttributesMessage() { List attributes = Lists.newArrayList(); if ((initBits & INIT_BIT_ORIGINAL) != 0) attributes.add("original"); return "Cannot build NoOriginalFieldCopyMethodConflict, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy