nonimmutables.imprt.ImmutableImportFromUppercasePackage Maven / Gradle / Ivy
Show all versions of value-fixture Show documentation
//-no-import-rewrite
package nonimmutables.imprt;
import java.lang.Object;
import java.lang.String;
import java.lang.Float;
import java.lang.Double;
/**
* Immutable implementation of {@link ImportFromUppercasePackage}.
*
* Use the builder to create immutable instances:
* {@code ImmutableImportFromUppercasePackage.builder()}.
*/
@org.immutables.value.Generated(from = "ImportFromUppercasePackage", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.ParametersAreNonnullByDefault
@javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor")
@javax.annotation.concurrent.Immutable
@javax.annotation.CheckReturnValue
public final class ImmutableImportFromUppercasePackage
implements nonimmutables.imprt.ImportFromUppercasePackage {
private final nonimmutables.Uppercase.Just just;
private final nonimmutables.Uppercase.nested.It it;
private ImmutableImportFromUppercasePackage(nonimmutables.Uppercase.Just just, nonimmutables.Uppercase.nested.It it) {
this.just = just;
this.it = it;
}
/**
* @return The value of the {@code just} attribute
*/
@Override
public nonimmutables.Uppercase.Just just() {
return just;
}
/**
* @return The value of the {@code it} attribute
*/
@Override
public nonimmutables.Uppercase.nested.It it() {
return it;
}
/**
* Copy the current immutable object by setting a value for the {@link ImportFromUppercasePackage#just() just} attribute.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for just
* @return A modified copy of the {@code this} object
*/
public final ImmutableImportFromUppercasePackage withJust(nonimmutables.Uppercase.Just value) {
if (this.just == value) return this;
nonimmutables.Uppercase.Just newValue = java.util.Objects.requireNonNull(value, "just");
return new ImmutableImportFromUppercasePackage(newValue, this.it);
}
/**
* Copy the current immutable object by setting a value for the {@link ImportFromUppercasePackage#it() it} attribute.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for it
* @return A modified copy of the {@code this} object
*/
public final ImmutableImportFromUppercasePackage withIt(nonimmutables.Uppercase.nested.It value) {
if (this.it == value) return this;
nonimmutables.Uppercase.nested.It newValue = java.util.Objects.requireNonNull(value, "it");
return new ImmutableImportFromUppercasePackage(this.just, newValue);
}
/**
* This instance is equal to all instances of {@code ImmutableImportFromUppercasePackage} that have equal attribute values.
* @return {@code true} if {@code this} is equal to {@code another} instance
*/
@Override
public boolean equals(@javax.annotation.Nullable Object another) {
if (this == another) return true;
return another instanceof ImmutableImportFromUppercasePackage
&& equalTo(0, (ImmutableImportFromUppercasePackage) another);
}
private boolean equalTo(int synthetic, ImmutableImportFromUppercasePackage another) {
return just.equals(another.just)
&& it.equals(another.it);
}
/**
* Computes a hash code from attributes: {@code just}, {@code it}.
* @return hashCode value
*/
@Override
public int hashCode() {
@com.google.errorprone.annotations.Var int h = 5381;
h += (h << 5) + just.hashCode();
h += (h << 5) + it.hashCode();
return h;
}
/**
* Prints the immutable value {@code ImportFromUppercasePackage} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return com.google.common.base.MoreObjects.toStringHelper("ImportFromUppercasePackage")
.omitNullValues()
.add("just", just)
.add("it", it)
.toString();
}
/**
* Creates an immutable copy of a {@link ImportFromUppercasePackage} 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 ImportFromUppercasePackage instance
*/
public static ImmutableImportFromUppercasePackage copyOf(ImportFromUppercasePackage instance) {
if (instance instanceof ImmutableImportFromUppercasePackage) {
return (ImmutableImportFromUppercasePackage) instance;
}
return ImmutableImportFromUppercasePackage.builder()
.from(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableImportFromUppercasePackage ImmutableImportFromUppercasePackage}.
*
* ImmutableImportFromUppercasePackage.builder()
* .just(nonimmutables.Uppercase.Just) // required {@link ImportFromUppercasePackage#just() just}
* .it(nonimmutables.Uppercase.nested.It) // required {@link ImportFromUppercasePackage#it() it}
* .build();
*
* @return A new ImmutableImportFromUppercasePackage builder
*/
public static ImmutableImportFromUppercasePackage.Builder builder() {
return new ImmutableImportFromUppercasePackage.Builder();
}
/**
* Builds instances of type {@link ImmutableImportFromUppercasePackage ImmutableImportFromUppercasePackage}.
* 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.
*/
@org.immutables.value.Generated(from = "ImportFromUppercasePackage", generator = "Immutables")
@javax.annotation.concurrent.NotThreadSafe
public static final class Builder {
private static final long INIT_BIT_JUST = 0x1L;
private static final long INIT_BIT_IT = 0x2L;
private long initBits = 0x3L;
private @javax.annotation.Nullable nonimmutables.Uppercase.Just just;
private @javax.annotation.Nullable nonimmutables.Uppercase.nested.It it;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code ImportFromUppercasePackage} 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
*/
@com.google.errorprone.annotations.CanIgnoreReturnValue
public final Builder from(ImportFromUppercasePackage instance) {
java.util.Objects.requireNonNull(instance, "instance");
just(instance.just());
it(instance.it());
return this;
}
/**
* Initializes the value for the {@link ImportFromUppercasePackage#just() just} attribute.
* @param just The value for just
* @return {@code this} builder for use in a chained invocation
*/
@com.google.errorprone.annotations.CanIgnoreReturnValue
public final Builder just(nonimmutables.Uppercase.Just just) {
this.just = java.util.Objects.requireNonNull(just, "just");
initBits &= ~INIT_BIT_JUST;
return this;
}
/**
* Initializes the value for the {@link ImportFromUppercasePackage#it() it} attribute.
* @param it The value for it
* @return {@code this} builder for use in a chained invocation
*/
@com.google.errorprone.annotations.CanIgnoreReturnValue
public final Builder it(nonimmutables.Uppercase.nested.It it) {
this.it = java.util.Objects.requireNonNull(it, "it");
initBits &= ~INIT_BIT_IT;
return this;
}
/**
* Builds a new {@link ImmutableImportFromUppercasePackage ImmutableImportFromUppercasePackage}.
* @return An immutable instance of ImportFromUppercasePackage
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableImportFromUppercasePackage build() {
if (initBits != 0) {
throw new java.lang.IllegalStateException(formatRequiredAttributesMessage());
}
return new ImmutableImportFromUppercasePackage(just, it);
}
private String formatRequiredAttributesMessage() {
java.util.List attributes = new java.util.ArrayList<>();
if ((initBits & INIT_BIT_JUST) != 0) attributes.add("just");
if ((initBits & INIT_BIT_IT) != 0) attributes.add("it");
return "Cannot build ImportFromUppercasePackage, some of required attributes are not set " + attributes;
}
}
}