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

io.resys.hdes.client.api.ImmutableImportStoreEntity Maven / Gradle / Ivy

There is a newer version: 3.130.78
Show newest version
package io.resys.hdes.client.api;

import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.Var;
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;

/**
 * Immutable implementation of {@link HdesStore.ImportStoreEntity}.
 * 

* Use the builder to create immutable instances: * {@code ImmutableImportStoreEntity.builder()}. */ @Generated(from = "HdesStore.ImportStoreEntity", generator = "Immutables") @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableImportStoreEntity implements HdesStore.ImportStoreEntity { private final ImmutableList create; private final ImmutableList update; private ImmutableImportStoreEntity( ImmutableList create, ImmutableList update) { this.create = create; this.update = update; } /** * @return The value of the {@code create} attribute */ @Override public ImmutableList getCreate() { return create; } /** * @return The value of the {@code update} attribute */ @Override public ImmutableList getUpdate() { return update; } /** * Copy the current immutable object with elements that replace the content of {@link HdesStore.ImportStoreEntity#getCreate() create}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableImportStoreEntity withCreate(HdesStore.CreateStoreEntity... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableImportStoreEntity(newValue, this.update); } /** * Copy the current immutable object with elements that replace the content of {@link HdesStore.ImportStoreEntity#getCreate() create}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of create elements to set * @return A modified copy of {@code this} object */ public final ImmutableImportStoreEntity withCreate(Iterable elements) { if (this.create == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableImportStoreEntity(newValue, this.update); } /** * Copy the current immutable object with elements that replace the content of {@link HdesStore.ImportStoreEntity#getUpdate() update}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableImportStoreEntity withUpdate(HdesStore.UpdateStoreEntityWithBodyType... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableImportStoreEntity(this.create, newValue); } /** * Copy the current immutable object with elements that replace the content of {@link HdesStore.ImportStoreEntity#getUpdate() update}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of update elements to set * @return A modified copy of {@code this} object */ public final ImmutableImportStoreEntity withUpdate(Iterable elements) { if (this.update == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableImportStoreEntity(this.create, newValue); } /** * This instance is equal to all instances of {@code ImmutableImportStoreEntity} 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 ImmutableImportStoreEntity && equalTo((ImmutableImportStoreEntity) another); } private boolean equalTo(ImmutableImportStoreEntity another) { return create.equals(another.create) && update.equals(another.update); } /** * Computes a hash code from attributes: {@code create}, {@code update}. * @return hashCode value */ @Override public int hashCode() { @Var int h = 5381; h += (h << 5) + create.hashCode(); h += (h << 5) + update.hashCode(); return h; } /** * Prints the immutable value {@code ImportStoreEntity} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("ImportStoreEntity") .omitNullValues() .add("create", create) .add("update", update) .toString(); } /** * Creates an immutable copy of a {@link HdesStore.ImportStoreEntity} 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 ImportStoreEntity instance */ public static ImmutableImportStoreEntity copyOf(HdesStore.ImportStoreEntity instance) { if (instance instanceof ImmutableImportStoreEntity) { return (ImmutableImportStoreEntity) instance; } return ImmutableImportStoreEntity.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableImportStoreEntity ImmutableImportStoreEntity}. *

   * ImmutableImportStoreEntity.builder()
   *    .addCreate|addAllCreate(io.resys.hdes.client.api.HdesStore.CreateStoreEntity) // {@link HdesStore.ImportStoreEntity#getCreate() create} elements
   *    .addUpdate|addAllUpdate(io.resys.hdes.client.api.HdesStore.UpdateStoreEntityWithBodyType) // {@link HdesStore.ImportStoreEntity#getUpdate() update} elements
   *    .build();
   * 
* @return A new ImmutableImportStoreEntity builder */ public static ImmutableImportStoreEntity.Builder builder() { return new ImmutableImportStoreEntity.Builder(); } /** * Builds instances of type {@link ImmutableImportStoreEntity ImmutableImportStoreEntity}. * 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 = "HdesStore.ImportStoreEntity", generator = "Immutables") @NotThreadSafe public static final class Builder { private ImmutableList.Builder create = ImmutableList.builder(); private ImmutableList.Builder update = ImmutableList.builder(); private Builder() { } /** * Fill a builder with attribute values from the provided {@code ImportStoreEntity} 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(HdesStore.ImportStoreEntity instance) { Objects.requireNonNull(instance, "instance"); addAllCreate(instance.getCreate()); addAllUpdate(instance.getUpdate()); return this; } /** * Adds one element to {@link HdesStore.ImportStoreEntity#getCreate() create} list. * @param element A create element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addCreate(HdesStore.CreateStoreEntity element) { this.create.add(element); return this; } /** * Adds elements to {@link HdesStore.ImportStoreEntity#getCreate() create} list. * @param elements An array of create elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addCreate(HdesStore.CreateStoreEntity... elements) { this.create.add(elements); return this; } /** * Sets or replaces all elements for {@link HdesStore.ImportStoreEntity#getCreate() create} list. * @param elements An iterable of create elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder create(Iterable elements) { this.create = ImmutableList.builder(); return addAllCreate(elements); } /** * Adds elements to {@link HdesStore.ImportStoreEntity#getCreate() create} list. * @param elements An iterable of create elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addAllCreate(Iterable elements) { this.create.addAll(elements); return this; } /** * Adds one element to {@link HdesStore.ImportStoreEntity#getUpdate() update} list. * @param element A update element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addUpdate(HdesStore.UpdateStoreEntityWithBodyType element) { this.update.add(element); return this; } /** * Adds elements to {@link HdesStore.ImportStoreEntity#getUpdate() update} list. * @param elements An array of update elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addUpdate(HdesStore.UpdateStoreEntityWithBodyType... elements) { this.update.add(elements); return this; } /** * Sets or replaces all elements for {@link HdesStore.ImportStoreEntity#getUpdate() update} list. * @param elements An iterable of update elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder update(Iterable elements) { this.update = ImmutableList.builder(); return addAllUpdate(elements); } /** * Adds elements to {@link HdesStore.ImportStoreEntity#getUpdate() update} list. * @param elements An iterable of update elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addAllUpdate(Iterable elements) { this.update.addAll(elements); return this; } /** * Builds a new {@link ImmutableImportStoreEntity ImmutableImportStoreEntity}. * @return An immutable instance of ImportStoreEntity * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableImportStoreEntity build() { return new ImmutableImportStoreEntity(create.build(), update.build()); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy