org.immutables.fixture.modifiable.ImmutableC Maven / Gradle / Ivy
package org.immutables.fixture.modifiable;
import com.google.common.base.MoreObjects;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
/**
* Immutable implementation of {@link ToImmutableCopyFalse.C}.
*
* Use the static factory method to create immutable instances:
* {@code ImmutableC.of()}.
*/
@SuppressWarnings("all")
@ParametersAreNonnullByDefault
@Generated({"Immutables.generator", "ToImmutableCopyFalse.C"})
@Immutable
public final class ImmutableC implements ToImmutableCopyFalse.C {
private final int c;
private ImmutableC(int c) {
this.c = c;
}
/**
* @return The value of the {@code c} attribute
*/
@Override
public int c() {
return c;
}
/**
* This instance is equal to all instances of {@code ImmutableC} 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 ImmutableC
&& equalTo((ImmutableC) another);
}
private boolean equalTo(ImmutableC another) {
return c == another.c;
}
/**
* Computes a hash code from attributes: {@code c}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 31;
h = h * 17 + c;
return h;
}
/**
* Prints the immutable value {@code C} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("C")
.omitNullValues()
.add("c", c)
.toString();
}
/**
* Construct a new immutable {@code C} instance.
* @param c The value for the {@code c} attribute
* @return An immutable C instance
*/
public static ImmutableC of(int c) {
return new ImmutableC(c);
}
}