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

io.resys.hdes.client.api.ast.ImmutableAstDecisionCell Maven / Gradle / Ivy

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

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.common.base.MoreObjects;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.Var;
import java.util.ArrayList;
import java.util.List;
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 AstDecision.AstDecisionCell}.
 * 

* Use the builder to create immutable instances: * {@code ImmutableAstDecisionCell.builder()}. */ @Generated(from = "AstDecision.AstDecisionCell", generator = "Immutables") @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableAstDecisionCell implements AstDecision.AstDecisionCell { private final String id; private final String header; private final @Nullable String value; private ImmutableAstDecisionCell(String id, String header, @Nullable String value) { this.id = id; this.header = header; this.value = value; } /** * @return The value of the {@code id} attribute */ @JsonProperty("id") @Override public String getId() { return id; } /** * @return The value of the {@code header} attribute */ @JsonProperty("header") @Override public String getHeader() { return header; } /** * @return The value of the {@code value} attribute */ @JsonProperty("value") @Override public @Nullable String getValue() { return value; } /** * Copy the current immutable object by setting a value for the {@link AstDecision.AstDecisionCell#getId() id} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for id * @return A modified copy of the {@code this} object */ public final ImmutableAstDecisionCell withId(String value) { String newValue = Objects.requireNonNull(value, "id"); if (this.id.equals(newValue)) return this; return new ImmutableAstDecisionCell(newValue, this.header, this.value); } /** * Copy the current immutable object by setting a value for the {@link AstDecision.AstDecisionCell#getHeader() header} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for header * @return A modified copy of the {@code this} object */ public final ImmutableAstDecisionCell withHeader(String value) { String newValue = Objects.requireNonNull(value, "header"); if (this.header.equals(newValue)) return this; return new ImmutableAstDecisionCell(this.id, newValue, this.value); } /** * Copy the current immutable object by setting a value for the {@link AstDecision.AstDecisionCell#getValue() value} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for value (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableAstDecisionCell withValue(@Nullable String value) { if (Objects.equals(this.value, value)) return this; return new ImmutableAstDecisionCell(this.id, this.header, value); } /** * This instance is equal to all instances of {@code ImmutableAstDecisionCell} 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 ImmutableAstDecisionCell && equalTo((ImmutableAstDecisionCell) another); } private boolean equalTo(ImmutableAstDecisionCell another) { return id.equals(another.id) && header.equals(another.header) && Objects.equals(value, another.value); } /** * Computes a hash code from attributes: {@code id}, {@code header}, {@code value}. * @return hashCode value */ @Override public int hashCode() { @Var int h = 5381; h += (h << 5) + id.hashCode(); h += (h << 5) + header.hashCode(); h += (h << 5) + Objects.hashCode(value); return h; } /** * Prints the immutable value {@code AstDecisionCell} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("AstDecisionCell") .omitNullValues() .add("id", id) .add("header", header) .add("value", value) .toString(); } /** * Utility type used to correctly read immutable object from JSON representation. * @deprecated Do not use this type directly, it exists only for the Jackson-binding infrastructure */ @Generated(from = "AstDecision.AstDecisionCell", generator = "Immutables") @Deprecated @SuppressWarnings("Immutable") @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements AstDecision.AstDecisionCell { @Nullable String id; @Nullable String header; @Nullable String value; @JsonProperty("id") public void setId(String id) { this.id = id; } @JsonProperty("header") public void setHeader(String header) { this.header = header; } @JsonProperty("value") public void setValue(@Nullable String value) { this.value = value; } @Override public String getId() { throw new UnsupportedOperationException(); } @Override public String getHeader() { throw new UnsupportedOperationException(); } @Override public String getValue() { throw new UnsupportedOperationException(); } } /** * @param json A JSON-bindable data structure * @return An immutable value type * @deprecated Do not use this method directly, it exists only for the Jackson-binding infrastructure */ @Deprecated @JsonCreator(mode = JsonCreator.Mode.DELEGATING) static ImmutableAstDecisionCell fromJson(Json json) { ImmutableAstDecisionCell.Builder builder = ImmutableAstDecisionCell.builder(); if (json.id != null) { builder.id(json.id); } if (json.header != null) { builder.header(json.header); } if (json.value != null) { builder.value(json.value); } return builder.build(); } /** * Creates an immutable copy of a {@link AstDecision.AstDecisionCell} 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 AstDecisionCell instance */ public static ImmutableAstDecisionCell copyOf(AstDecision.AstDecisionCell instance) { if (instance instanceof ImmutableAstDecisionCell) { return (ImmutableAstDecisionCell) instance; } return ImmutableAstDecisionCell.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableAstDecisionCell ImmutableAstDecisionCell}. *

   * ImmutableAstDecisionCell.builder()
   *    .id(String) // required {@link AstDecision.AstDecisionCell#getId() id}
   *    .header(String) // required {@link AstDecision.AstDecisionCell#getHeader() header}
   *    .value(String | null) // nullable {@link AstDecision.AstDecisionCell#getValue() value}
   *    .build();
   * 
* @return A new ImmutableAstDecisionCell builder */ public static ImmutableAstDecisionCell.Builder builder() { return new ImmutableAstDecisionCell.Builder(); } /** * Builds instances of type {@link ImmutableAstDecisionCell ImmutableAstDecisionCell}. * 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 = "AstDecision.AstDecisionCell", generator = "Immutables") @NotThreadSafe public static final class Builder { private static final long INIT_BIT_ID = 0x1L; private static final long INIT_BIT_HEADER = 0x2L; private long initBits = 0x3L; private @Nullable String id; private @Nullable String header; private @Nullable String value; private Builder() { } /** * Fill a builder with attribute values from the provided {@code AstDecisionCell} 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 */ @CanIgnoreReturnValue public final Builder from(AstDecision.AstDecisionCell instance) { Objects.requireNonNull(instance, "instance"); id(instance.getId()); header(instance.getHeader()); @Nullable String valueValue = instance.getValue(); if (valueValue != null) { value(valueValue); } return this; } /** * Initializes the value for the {@link AstDecision.AstDecisionCell#getId() id} attribute. * @param id The value for id * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("id") public final Builder id(String id) { this.id = Objects.requireNonNull(id, "id"); initBits &= ~INIT_BIT_ID; return this; } /** * Initializes the value for the {@link AstDecision.AstDecisionCell#getHeader() header} attribute. * @param header The value for header * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("header") public final Builder header(String header) { this.header = Objects.requireNonNull(header, "header"); initBits &= ~INIT_BIT_HEADER; return this; } /** * Initializes the value for the {@link AstDecision.AstDecisionCell#getValue() value} attribute. * @param value The value for value (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("value") public final Builder value(@Nullable String value) { this.value = value; return this; } /** * Builds a new {@link ImmutableAstDecisionCell ImmutableAstDecisionCell}. * @return An immutable instance of AstDecisionCell * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableAstDecisionCell build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableAstDecisionCell(id, header, value); } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if ((initBits & INIT_BIT_ID) != 0) attributes.add("id"); if ((initBits & INIT_BIT_HEADER) != 0) attributes.add("header"); return "Cannot build AstDecisionCell, some of required attributes are not set " + attributes; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy