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

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

package org.immutables.fixture;

import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.primitives.Booleans;
import com.google.common.primitives.Bytes;
import com.google.common.primitives.Chars;
import com.google.common.primitives.Doubles;
import com.google.common.primitives.Floats;
import com.google.common.primitives.Longs;
import com.google.common.primitives.Shorts;
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 PrivateNoargConstructorNominal}.
 * 

* Use the builder to create immutable instances: * {@code ImmutablePrivateNoargConstructorNominal.builder()}. */ @SuppressWarnings("all") @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "PrivateNoargConstructorNominal"}) @Immutable final class ImmutablePrivateNoargConstructorNominal implements PrivateNoargConstructorNominal { private final boolean is; private final byte b; private final short s; private final int i; private final long l; private final char c; private final float f; private final double d; private final Object o; private ImmutablePrivateNoargConstructorNominal() { this.is = false; this.b = 0; this.s = 0; this.i = 0; this.l = 0; this.c = 0; this.f = 0; this.d = 0; this.o = null; } private ImmutablePrivateNoargConstructorNominal(boolean is, byte b, short s, int i, long l, char c, float f, double d, Object o) { this.is = is; this.b = b; this.s = s; this.i = i; this.l = l; this.c = c; this.f = f; this.d = d; this.o = o; } /** * @return The value of the {@code is} attribute */ @Override public boolean is() { return is; } /** * @return The value of the {@code b} attribute */ @Override public byte b() { return b; } /** * @return The value of the {@code s} attribute */ @Override public short s() { return s; } /** * @return The value of the {@code i} attribute */ @Override public int i() { return i; } /** * @return The value of the {@code l} attribute */ @Override public long l() { return l; } /** * @return The value of the {@code c} attribute */ @Override public char c() { return c; } /** * @return The value of the {@code f} attribute */ @Override public float f() { return f; } /** * @return The value of the {@code d} attribute */ @Override public double d() { return d; } /** * @return The value of the {@code o} attribute */ @Override public Object o() { return o; } /** * Copy the current immutable object by setting a value for the {@link PrivateNoargConstructorNominal#is() is} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param is A new value for is * @return A modified copy of the {@code this} object */ public final ImmutablePrivateNoargConstructorNominal withIs(boolean is) { if (this.is == is) return this; return new ImmutablePrivateNoargConstructorNominal(is, this.b, this.s, this.i, this.l, this.c, this.f, this.d, this.o); } /** * Copy the current immutable object by setting a value for the {@link PrivateNoargConstructorNominal#b() b} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param b A new value for b * @return A modified copy of the {@code this} object */ public final ImmutablePrivateNoargConstructorNominal withB(byte b) { if (this.b == b) return this; return new ImmutablePrivateNoargConstructorNominal(this.is, b, this.s, this.i, this.l, this.c, this.f, this.d, this.o); } /** * Copy the current immutable object by setting a value for the {@link PrivateNoargConstructorNominal#s() s} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param s A new value for s * @return A modified copy of the {@code this} object */ public final ImmutablePrivateNoargConstructorNominal withS(short s) { if (this.s == s) return this; return new ImmutablePrivateNoargConstructorNominal(this.is, this.b, s, this.i, this.l, this.c, this.f, this.d, this.o); } /** * Copy the current immutable object by setting a value for the {@link PrivateNoargConstructorNominal#i() i} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param i A new value for i * @return A modified copy of the {@code this} object */ public final ImmutablePrivateNoargConstructorNominal withI(int i) { if (this.i == i) return this; return new ImmutablePrivateNoargConstructorNominal(this.is, this.b, this.s, i, this.l, this.c, this.f, this.d, this.o); } /** * Copy the current immutable object by setting a value for the {@link PrivateNoargConstructorNominal#l() l} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param l A new value for l * @return A modified copy of the {@code this} object */ public final ImmutablePrivateNoargConstructorNominal withL(long l) { if (this.l == l) return this; return new ImmutablePrivateNoargConstructorNominal(this.is, this.b, this.s, this.i, l, this.c, this.f, this.d, this.o); } /** * Copy the current immutable object by setting a value for the {@link PrivateNoargConstructorNominal#c() c} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param c A new value for c * @return A modified copy of the {@code this} object */ public final ImmutablePrivateNoargConstructorNominal withC(char c) { if (this.c == c) return this; return new ImmutablePrivateNoargConstructorNominal(this.is, this.b, this.s, this.i, this.l, c, this.f, this.d, this.o); } /** * Copy the current immutable object by setting a value for the {@link PrivateNoargConstructorNominal#f() f} attribute. * A value strict bits equality used to prevent copying of the same value by returning {@code this}. * @param f A new value for f * @return A modified copy of the {@code this} object */ public final ImmutablePrivateNoargConstructorNominal withF(float f) { if (Float.floatToIntBits(this.f) == Float.floatToIntBits(f)) return this; return new ImmutablePrivateNoargConstructorNominal(this.is, this.b, this.s, this.i, this.l, this.c, f, this.d, this.o); } /** * Copy the current immutable object by setting a value for the {@link PrivateNoargConstructorNominal#d() d} attribute. * A value strict bits equality used to prevent copying of the same value by returning {@code this}. * @param d A new value for d * @return A modified copy of the {@code this} object */ public final ImmutablePrivateNoargConstructorNominal withD(double d) { if (Double.doubleToLongBits(this.d) == Double.doubleToLongBits(d)) return this; return new ImmutablePrivateNoargConstructorNominal(this.is, this.b, this.s, this.i, this.l, this.c, this.f, d, this.o); } /** * Copy the current immutable object by setting a value for the {@link PrivateNoargConstructorNominal#o() o} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param o A new value for o * @return A modified copy of the {@code this} object */ public final ImmutablePrivateNoargConstructorNominal withO(Object o) { if (this.o == o) return this; Object newValue = Preconditions.checkNotNull(o, "o"); return new ImmutablePrivateNoargConstructorNominal(this.is, this.b, this.s, this.i, this.l, this.c, this.f, this.d, newValue); } /** * This instance is equal to all instances of {@code ImmutablePrivateNoargConstructorNominal} 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 ImmutablePrivateNoargConstructorNominal && equalTo((ImmutablePrivateNoargConstructorNominal) another); } private boolean equalTo(ImmutablePrivateNoargConstructorNominal another) { return is == another.is && b == another.b && s == another.s && i == another.i && l == another.l && c == another.c && Float.floatToIntBits(f) == Float.floatToIntBits(another.f) && Double.doubleToLongBits(d) == Double.doubleToLongBits(another.d) && o.equals(another.o); } /** * Computes a hash code from attributes: {@code is}, {@code b}, {@code s}, {@code i}, {@code l}, {@code c}, {@code f}, {@code d}, {@code o}. * @return hashCode value */ @Override public int hashCode() { int h = 31; h = h * 17 + Booleans.hashCode(is); h = h * 17 + Bytes.hashCode(b); h = h * 17 + Shorts.hashCode(s); h = h * 17 + i; h = h * 17 + Longs.hashCode(l); h = h * 17 + Chars.hashCode(c); h = h * 17 + Floats.hashCode(f); h = h * 17 + Doubles.hashCode(d); h = h * 17 + o.hashCode(); return h; } /** * Prints the immutable value {@code PrivateNoargConstructorNominal} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("PrivateNoargConstructorNominal") .omitNullValues() .add("is", is) .add("b", b) .add("s", s) .add("i", i) .add("l", l) .add("c", c) .add("f", f) .add("d", d) .add("o", o) .toString(); } /** * Creates an immutable copy of a {@link PrivateNoargConstructorNominal} 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 PrivateNoargConstructorNominal instance */ public static ImmutablePrivateNoargConstructorNominal copyOf(PrivateNoargConstructorNominal instance) { if (instance instanceof ImmutablePrivateNoargConstructorNominal) { return (ImmutablePrivateNoargConstructorNominal) instance; } return ImmutablePrivateNoargConstructorNominal.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutablePrivateNoargConstructorNominal ImmutablePrivateNoargConstructorNominal}. * @return A new ImmutablePrivateNoargConstructorNominal builder */ public static ImmutablePrivateNoargConstructorNominal.Builder builder() { return new ImmutablePrivateNoargConstructorNominal.Builder(); } /** * Builds instances of type {@link ImmutablePrivateNoargConstructorNominal ImmutablePrivateNoargConstructorNominal}. * 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_IS = 0x1L; private static final long INIT_BIT_B = 0x2L; private static final long INIT_BIT_S = 0x4L; private static final long INIT_BIT_I = 0x8L; private static final long INIT_BIT_L = 0x10L; private static final long INIT_BIT_C = 0x20L; private static final long INIT_BIT_F = 0x40L; private static final long INIT_BIT_D = 0x80L; private static final long INIT_BIT_O = 0x100L; private long initBits = 0x1ffL; private boolean is; private byte b; private short s; private int i; private long l; private char c; private float f; private double d; private @Nullable Object o; private Builder() { } /** * Fill a builder with attribute values from the provided {@code PrivateNoargConstructorNominal} 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(PrivateNoargConstructorNominal instance) { Preconditions.checkNotNull(instance, "instance"); is(instance.is()); b(instance.b()); s(instance.s()); i(instance.i()); l(instance.l()); c(instance.c()); f(instance.f()); d(instance.d()); o(instance.o()); return this; } /** * Initializes the value for the {@link PrivateNoargConstructorNominal#is() is} attribute. * @param is The value for is * @return {@code this} builder for use in a chained invocation */ public final Builder is(boolean is) { this.is = is; initBits &= ~INIT_BIT_IS; return this; } /** * Initializes the value for the {@link PrivateNoargConstructorNominal#b() b} attribute. * @param b The value for b * @return {@code this} builder for use in a chained invocation */ public final Builder b(byte b) { this.b = b; initBits &= ~INIT_BIT_B; return this; } /** * Initializes the value for the {@link PrivateNoargConstructorNominal#s() s} attribute. * @param s The value for s * @return {@code this} builder for use in a chained invocation */ public final Builder s(short s) { this.s = s; initBits &= ~INIT_BIT_S; return this; } /** * Initializes the value for the {@link PrivateNoargConstructorNominal#i() i} attribute. * @param i The value for i * @return {@code this} builder for use in a chained invocation */ public final Builder i(int i) { this.i = i; initBits &= ~INIT_BIT_I; return this; } /** * Initializes the value for the {@link PrivateNoargConstructorNominal#l() l} attribute. * @param l The value for l * @return {@code this} builder for use in a chained invocation */ public final Builder l(long l) { this.l = l; initBits &= ~INIT_BIT_L; return this; } /** * Initializes the value for the {@link PrivateNoargConstructorNominal#c() c} attribute. * @param c The value for c * @return {@code this} builder for use in a chained invocation */ public final Builder c(char c) { this.c = c; initBits &= ~INIT_BIT_C; return this; } /** * Initializes the value for the {@link PrivateNoargConstructorNominal#f() f} attribute. * @param f The value for f * @return {@code this} builder for use in a chained invocation */ public final Builder f(float f) { this.f = f; initBits &= ~INIT_BIT_F; return this; } /** * Initializes the value for the {@link PrivateNoargConstructorNominal#d() d} attribute. * @param d The value for d * @return {@code this} builder for use in a chained invocation */ public final Builder d(double d) { this.d = d; initBits &= ~INIT_BIT_D; return this; } /** * Initializes the value for the {@link PrivateNoargConstructorNominal#o() o} attribute. * @param o The value for o * @return {@code this} builder for use in a chained invocation */ public final Builder o(Object o) { this.o = Preconditions.checkNotNull(o, "o"); initBits &= ~INIT_BIT_O; return this; } /** * Builds a new {@link ImmutablePrivateNoargConstructorNominal ImmutablePrivateNoargConstructorNominal}. * @return An immutable instance of PrivateNoargConstructorNominal * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutablePrivateNoargConstructorNominal build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutablePrivateNoargConstructorNominal(is, b, s, i, l, c, f, d, o); } private String formatRequiredAttributesMessage() { List attributes = Lists.newArrayList(); if ((initBits & INIT_BIT_IS) != 0) attributes.add("is"); if ((initBits & INIT_BIT_B) != 0) attributes.add("b"); if ((initBits & INIT_BIT_S) != 0) attributes.add("s"); if ((initBits & INIT_BIT_I) != 0) attributes.add("i"); if ((initBits & INIT_BIT_L) != 0) attributes.add("l"); if ((initBits & INIT_BIT_C) != 0) attributes.add("c"); if ((initBits & INIT_BIT_F) != 0) attributes.add("f"); if ((initBits & INIT_BIT_D) != 0) attributes.add("d"); if ((initBits & INIT_BIT_O) != 0) attributes.add("o"); return "Cannot build PrivateNoargConstructorNominal, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy