org.immutables.fixture.generics.ImmutableMultimapSafeVarargs Maven / Gradle / Ivy
Show all versions of value-fixture Show documentation
package org.immutables.fixture.generics;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.Var;
import java.util.Arrays;
import java.util.Map;
import java.util.Objects;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import org.immutables.value.Generated;
/**
* {@code ImmutableMultimapSafeVarargs} contains immutable implementation classes generated from
* abstract value types defined as nested inside {@link MultimapSafeVarargs}.
* @see ImmutableMultimapSafeVarargs.ParamKey
* @see ImmutableMultimapSafeVarargs.ParamVal
* @see ImmutableMultimapSafeVarargs.ParamBoth
*/
@Generated(from = "MultimapSafeVarargs", generator = "Immutables")
@SuppressWarnings({"all"})
@ParametersAreNonnullByDefault
@javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableMultimapSafeVarargs {
private ImmutableMultimapSafeVarargs() {}
/**
* Immutable implementation of {@link MultimapSafeVarargs.ParamKey}.
*
* Use the builder to create immutable instances:
* {@code ImmutableMultimapSafeVarargs.ParamKey.builder()}.
*/
@Generated(from = "MultimapSafeVarargs.ParamKey", generator = "Immutables")
@Immutable
@CheckReturnValue
public static final class ParamKey implements MultimapSafeVarargs.ParamKey {
private final ImmutableMultimap, String> vals;
private ParamKey(
ImmutableMultimap, String> vals) {
this.vals = vals;
}
/**
* @return The value of the {@code vals} attribute
*/
@Override
public ImmutableMultimap, String> vals() {
return vals;
}
/**
* Copy the current immutable object by replacing the {@link MultimapSafeVarargs.ParamKey#vals() vals} map with the specified map.
* Nulls are not permitted as keys or values.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param entries The entries to be added to the vals map
* @return A modified copy of {@code this} object
*/
public final ImmutableMultimapSafeVarargs.ParamKey withVals(Multimap extends MultimapSafeVarargs.Val, ? extends String> entries) {
if (this.vals == entries) return this;
ImmutableMultimap, String> newValue = ImmutableMultimap.copyOf(entries);
return new ImmutableMultimapSafeVarargs.ParamKey(newValue);
}
/**
* This instance is equal to all instances of {@code ParamKey} 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 ImmutableMultimapSafeVarargs.ParamKey
&& equalTo(0, (ImmutableMultimapSafeVarargs.ParamKey) another);
}
private boolean equalTo(int synthetic, ImmutableMultimapSafeVarargs.ParamKey another) {
return vals.equals(another.vals);
}
/**
* Computes a hash code from attributes: {@code vals}.
* @return hashCode value
*/
@Override
public int hashCode() {
@Var int h = 5381;
h += (h << 5) + vals.hashCode();
return h;
}
/**
* Prints the immutable value {@code ParamKey} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("ParamKey")
.omitNullValues()
.add("vals", vals)
.toString();
}
/**
* Creates an immutable copy of a {@link MultimapSafeVarargs.ParamKey} 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 ParamKey instance
*/
public static ImmutableMultimapSafeVarargs.ParamKey copyOf(MultimapSafeVarargs.ParamKey instance) {
if (instance instanceof ImmutableMultimapSafeVarargs.ParamKey) {
return (ImmutableMultimapSafeVarargs.ParamKey) instance;
}
return ImmutableMultimapSafeVarargs.ParamKey.builder()
.from(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableMultimapSafeVarargs.ParamKey ParamKey}.
*
* ImmutableMultimapSafeVarargs.ParamKey.builder()
* .putVals|putAllVals(org.immutables.fixture.generics.MultimapSafeVarargs.Val<String> => String) // {@link MultimapSafeVarargs.ParamKey#vals() vals} mappings
* .build();
*
* @return A new ParamKey builder
*/
public static ImmutableMultimapSafeVarargs.ParamKey.Builder builder() {
return new ImmutableMultimapSafeVarargs.ParamKey.Builder();
}
/**
* Builds instances of type {@link ImmutableMultimapSafeVarargs.ParamKey ParamKey}.
* 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.
*/
@Generated(from = "MultimapSafeVarargs.ParamKey", generator = "Immutables")
@NotThreadSafe
public static final class Builder {
private ImmutableMultimap.Builder, String> vals = ImmutableMultimap.builder();
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code ParamKey} 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
*/
@CanIgnoreReturnValue
public final Builder from(MultimapSafeVarargs.ParamKey instance) {
Objects.requireNonNull(instance, "instance");
putAllVals(instance.vals());
return this;
}
/**
* Put all mappings from the specified key to values for {@link MultimapSafeVarargs.ParamKey#vals() vals} true. Nulls are not permitted
* @param key The key for vals
* @param values The values for vals
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putVals(MultimapSafeVarargs.Val key, String... values) {
this.vals.putAll(key, Arrays.asList(values));
return this;
}
/**
* Put all mappings from the specified key to values for {@link MultimapSafeVarargs.ParamKey#vals() vals} true. Nulls are not permitted
* @param key The key for vals
* @param values The values for vals
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putAllVals(MultimapSafeVarargs.Val key, Iterable values) {
this.vals.putAll(key, values);
return this;
}
/**
* Put one entry to the {@link MultimapSafeVarargs.ParamKey#vals() vals} map.
* @param key The key in the vals map
* @param value The associated value in the vals map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putVals(MultimapSafeVarargs.Val key, String value) {
this.vals.put(key, value);
return this;
}
/**
* Put one entry to the {@link MultimapSafeVarargs.ParamKey#vals() vals} map. Nulls are not permitted
* @param entry The key and value entry
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putVals(Map.Entry extends MultimapSafeVarargs.Val, ? extends String> entry) {
this.vals.put(entry);
return this;
}
/**
* Sets or replaces all mappings from the specified map as entries for the {@link MultimapSafeVarargs.ParamKey#vals() vals} map. Nulls are not permitted
* @param entries The entries that will be added to the vals map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder vals(Multimap extends MultimapSafeVarargs.Val, ? extends String> entries) {
this.vals = ImmutableMultimap.builder();
return putAllVals(entries);
}
/**
* Put all mappings from the specified map as entries to {@link MultimapSafeVarargs.ParamKey#vals() vals} map. Nulls are not permitted
* @param entries The entries that will be added to the vals map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putAllVals(Multimap extends MultimapSafeVarargs.Val, ? extends String> entries) {
this.vals.putAll(entries);
return this;
}
/**
* Builds a new {@link ImmutableMultimapSafeVarargs.ParamKey ParamKey}.
* @return An immutable instance of ParamKey
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableMultimapSafeVarargs.ParamKey build() {
return new ImmutableMultimapSafeVarargs.ParamKey(vals.build());
}
}
}
/**
* Immutable implementation of {@link MultimapSafeVarargs.ParamVal}.
*
* Use the builder to create immutable instances:
* {@code ImmutableMultimapSafeVarargs.ParamVal.builder()}.
*/
@Generated(from = "MultimapSafeVarargs.ParamVal", generator = "Immutables")
@Immutable
@CheckReturnValue
public static final class ParamVal implements MultimapSafeVarargs.ParamVal {
private final ImmutableMultimap> vals;
private ParamVal(
ImmutableMultimap> vals) {
this.vals = vals;
}
/**
* @return The value of the {@code vals} attribute
*/
@Override
public ImmutableMultimap> vals() {
return vals;
}
/**
* Copy the current immutable object by replacing the {@link MultimapSafeVarargs.ParamVal#vals() vals} map with the specified map.
* Nulls are not permitted as keys or values.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param entries The entries to be added to the vals map
* @return A modified copy of {@code this} object
*/
public final ImmutableMultimapSafeVarargs.ParamVal withVals(Multimap> entries) {
if (this.vals == entries) return this;
ImmutableMultimap> newValue = ImmutableMultimap.copyOf(entries);
return new ImmutableMultimapSafeVarargs.ParamVal(newValue);
}
/**
* This instance is equal to all instances of {@code ParamVal} 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 ImmutableMultimapSafeVarargs.ParamVal
&& equalTo(0, (ImmutableMultimapSafeVarargs.ParamVal) another);
}
private boolean equalTo(int synthetic, ImmutableMultimapSafeVarargs.ParamVal another) {
return vals.equals(another.vals);
}
/**
* Computes a hash code from attributes: {@code vals}.
* @return hashCode value
*/
@Override
public int hashCode() {
@Var int h = 5381;
h += (h << 5) + vals.hashCode();
return h;
}
/**
* Prints the immutable value {@code ParamVal} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("ParamVal")
.omitNullValues()
.add("vals", vals)
.toString();
}
/**
* Creates an immutable copy of a {@link MultimapSafeVarargs.ParamVal} 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 ParamVal instance
*/
public static ImmutableMultimapSafeVarargs.ParamVal copyOf(MultimapSafeVarargs.ParamVal instance) {
if (instance instanceof ImmutableMultimapSafeVarargs.ParamVal) {
return (ImmutableMultimapSafeVarargs.ParamVal) instance;
}
return ImmutableMultimapSafeVarargs.ParamVal.builder()
.from(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableMultimapSafeVarargs.ParamVal ParamVal}.
*
* ImmutableMultimapSafeVarargs.ParamVal.builder()
* .putVals|putAllVals(String => org.immutables.fixture.generics.MultimapSafeVarargs.Val<String>) // {@link MultimapSafeVarargs.ParamVal#vals() vals} mappings
* .build();
*
* @return A new ParamVal builder
*/
public static ImmutableMultimapSafeVarargs.ParamVal.Builder builder() {
return new ImmutableMultimapSafeVarargs.ParamVal.Builder();
}
/**
* Builds instances of type {@link ImmutableMultimapSafeVarargs.ParamVal ParamVal}.
* 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.
*/
@Generated(from = "MultimapSafeVarargs.ParamVal", generator = "Immutables")
@NotThreadSafe
public static final class Builder {
private ImmutableMultimap.Builder> vals = ImmutableMultimap.builder();
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code ParamVal} 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
*/
@CanIgnoreReturnValue
public final Builder from(MultimapSafeVarargs.ParamVal instance) {
Objects.requireNonNull(instance, "instance");
putAllVals(instance.vals());
return this;
}
/**
* Put all mappings from the specified key to values for {@link MultimapSafeVarargs.ParamVal#vals() vals} true. Nulls are not permitted
* @param key The key for vals
* @param values The values for vals
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@SafeVarargs @SuppressWarnings("varargs")
public final Builder putVals(String key, MultimapSafeVarargs.Val... values) {
this.vals.putAll(key, Arrays.asList(values));
return this;
}
/**
* Put all mappings from the specified key to values for {@link MultimapSafeVarargs.ParamVal#vals() vals} true. Nulls are not permitted
* @param key The key for vals
* @param values The values for vals
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putAllVals(String key, Iterable> values) {
this.vals.putAll(key, values);
return this;
}
/**
* Put one entry to the {@link MultimapSafeVarargs.ParamVal#vals() vals} map.
* @param key The key in the vals map
* @param value The associated value in the vals map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putVals(String key, MultimapSafeVarargs.Val value) {
this.vals.put(key, value);
return this;
}
/**
* Put one entry to the {@link MultimapSafeVarargs.ParamVal#vals() vals} map. Nulls are not permitted
* @param entry The key and value entry
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putVals(Map.Entry> entry) {
this.vals.put(entry);
return this;
}
/**
* Sets or replaces all mappings from the specified map as entries for the {@link MultimapSafeVarargs.ParamVal#vals() vals} map. Nulls are not permitted
* @param entries The entries that will be added to the vals map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder vals(Multimap> entries) {
this.vals = ImmutableMultimap.builder();
return putAllVals(entries);
}
/**
* Put all mappings from the specified map as entries to {@link MultimapSafeVarargs.ParamVal#vals() vals} map. Nulls are not permitted
* @param entries The entries that will be added to the vals map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putAllVals(Multimap> entries) {
this.vals.putAll(entries);
return this;
}
/**
* Builds a new {@link ImmutableMultimapSafeVarargs.ParamVal ParamVal}.
* @return An immutable instance of ParamVal
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableMultimapSafeVarargs.ParamVal build() {
return new ImmutableMultimapSafeVarargs.ParamVal(vals.build());
}
}
}
/**
* Immutable implementation of {@link MultimapSafeVarargs.ParamBoth}.
*
* Use the builder to create immutable instances:
* {@code ImmutableMultimapSafeVarargs.ParamBoth.builder()}.
*/
@Generated(from = "MultimapSafeVarargs.ParamBoth", generator = "Immutables")
@Immutable
@CheckReturnValue
public static final class ParamBoth implements MultimapSafeVarargs.ParamBoth {
private final ImmutableMultimap, MultimapSafeVarargs.Val> vals;
private ParamBoth(
ImmutableMultimap, MultimapSafeVarargs.Val> vals) {
this.vals = vals;
}
/**
* @return The value of the {@code vals} attribute
*/
@Override
public ImmutableMultimap, MultimapSafeVarargs.Val> vals() {
return vals;
}
/**
* Copy the current immutable object by replacing the {@link MultimapSafeVarargs.ParamBoth#vals() vals} map with the specified map.
* Nulls are not permitted as keys or values.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param entries The entries to be added to the vals map
* @return A modified copy of {@code this} object
*/
public final ImmutableMultimapSafeVarargs.ParamBoth withVals(Multimap extends MultimapSafeVarargs.Val, ? extends MultimapSafeVarargs.Val> entries) {
if (this.vals == entries) return this;
ImmutableMultimap, MultimapSafeVarargs.Val> newValue = ImmutableMultimap.copyOf(entries);
return new ImmutableMultimapSafeVarargs.ParamBoth(newValue);
}
/**
* This instance is equal to all instances of {@code ParamBoth} 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 ImmutableMultimapSafeVarargs.ParamBoth
&& equalTo(0, (ImmutableMultimapSafeVarargs.ParamBoth) another);
}
private boolean equalTo(int synthetic, ImmutableMultimapSafeVarargs.ParamBoth another) {
return vals.equals(another.vals);
}
/**
* Computes a hash code from attributes: {@code vals}.
* @return hashCode value
*/
@Override
public int hashCode() {
@Var int h = 5381;
h += (h << 5) + vals.hashCode();
return h;
}
/**
* Prints the immutable value {@code ParamBoth} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("ParamBoth")
.omitNullValues()
.add("vals", vals)
.toString();
}
/**
* Creates an immutable copy of a {@link MultimapSafeVarargs.ParamBoth} 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 ParamBoth instance
*/
public static ImmutableMultimapSafeVarargs.ParamBoth copyOf(MultimapSafeVarargs.ParamBoth instance) {
if (instance instanceof ImmutableMultimapSafeVarargs.ParamBoth) {
return (ImmutableMultimapSafeVarargs.ParamBoth) instance;
}
return ImmutableMultimapSafeVarargs.ParamBoth.builder()
.from(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableMultimapSafeVarargs.ParamBoth ParamBoth}.
*
* ImmutableMultimapSafeVarargs.ParamBoth.builder()
* .putVals|putAllVals(org.immutables.fixture.generics.MultimapSafeVarargs.Val<String> => org.immutables.fixture.generics.MultimapSafeVarargs.Val<String>) // {@link MultimapSafeVarargs.ParamBoth#vals() vals} mappings
* .build();
*
* @return A new ParamBoth builder
*/
public static ImmutableMultimapSafeVarargs.ParamBoth.Builder builder() {
return new ImmutableMultimapSafeVarargs.ParamBoth.Builder();
}
/**
* Builds instances of type {@link ImmutableMultimapSafeVarargs.ParamBoth ParamBoth}.
* 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.
*/
@Generated(from = "MultimapSafeVarargs.ParamBoth", generator = "Immutables")
@NotThreadSafe
public static final class Builder {
private ImmutableMultimap.Builder, MultimapSafeVarargs.Val> vals = ImmutableMultimap.builder();
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code ParamBoth} 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
*/
@CanIgnoreReturnValue
public final Builder from(MultimapSafeVarargs.ParamBoth instance) {
Objects.requireNonNull(instance, "instance");
putAllVals(instance.vals());
return this;
}
/**
* Put all mappings from the specified key to values for {@link MultimapSafeVarargs.ParamBoth#vals() vals} true. Nulls are not permitted
* @param key The key for vals
* @param values The values for vals
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@SafeVarargs @SuppressWarnings("varargs")
public final Builder putVals(MultimapSafeVarargs.Val key, MultimapSafeVarargs.Val... values) {
this.vals.putAll(key, Arrays.asList(values));
return this;
}
/**
* Put all mappings from the specified key to values for {@link MultimapSafeVarargs.ParamBoth#vals() vals} true. Nulls are not permitted
* @param key The key for vals
* @param values The values for vals
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putAllVals(MultimapSafeVarargs.Val key, Iterable> values) {
this.vals.putAll(key, values);
return this;
}
/**
* Put one entry to the {@link MultimapSafeVarargs.ParamBoth#vals() vals} map.
* @param key The key in the vals map
* @param value The associated value in the vals map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putVals(MultimapSafeVarargs.Val key, MultimapSafeVarargs.Val value) {
this.vals.put(key, value);
return this;
}
/**
* Put one entry to the {@link MultimapSafeVarargs.ParamBoth#vals() vals} map. Nulls are not permitted
* @param entry The key and value entry
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putVals(Map.Entry extends MultimapSafeVarargs.Val, ? extends MultimapSafeVarargs.Val> entry) {
this.vals.put(entry);
return this;
}
/**
* Sets or replaces all mappings from the specified map as entries for the {@link MultimapSafeVarargs.ParamBoth#vals() vals} map. Nulls are not permitted
* @param entries The entries that will be added to the vals map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder vals(Multimap extends MultimapSafeVarargs.Val, ? extends MultimapSafeVarargs.Val> entries) {
this.vals = ImmutableMultimap.builder();
return putAllVals(entries);
}
/**
* Put all mappings from the specified map as entries to {@link MultimapSafeVarargs.ParamBoth#vals() vals} map. Nulls are not permitted
* @param entries The entries that will be added to the vals map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putAllVals(Multimap extends MultimapSafeVarargs.Val, ? extends MultimapSafeVarargs.Val> entries) {
this.vals.putAll(entries);
return this;
}
/**
* Builds a new {@link ImmutableMultimapSafeVarargs.ParamBoth ParamBoth}.
* @return An immutable instance of ParamBoth
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableMultimapSafeVarargs.ParamBoth build() {
return new ImmutableMultimapSafeVarargs.ParamBoth(vals.build());
}
}
}
}