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

io.resys.hdes.client.api.ast.ImmutableAstService 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.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
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.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 AstService}.
 * 

* Use the builder to create immutable instances: * {@code ImmutableAstService.builder()}. */ @Generated(from = "AstService", generator = "Immutables") @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableAstService implements AstService { private final String name; private final @Nullable String description; private final AstBody.Headers headers; private final AstBody.AstBodyType bodyType; private final ImmutableList messages; private final Class beanType; private final String value; private final @Nullable TypeDef typeDef0; private final @Nullable TypeDef typeDef1; private final @Nullable TypeDef returnDef1; private final ImmutableList refs; private final AstService.AstServiceType executorType; private ImmutableAstService( String name, @Nullable String description, AstBody.Headers headers, AstBody.AstBodyType bodyType, ImmutableList messages, Class beanType, String value, @Nullable TypeDef typeDef0, @Nullable TypeDef typeDef1, @Nullable TypeDef returnDef1, ImmutableList refs, AstService.AstServiceType executorType) { this.name = name; this.description = description; this.headers = headers; this.bodyType = bodyType; this.messages = messages; this.beanType = beanType; this.value = value; this.typeDef0 = typeDef0; this.typeDef1 = typeDef1; this.returnDef1 = returnDef1; this.refs = refs; this.executorType = executorType; } /** * @return The value of the {@code name} attribute */ @JsonProperty("name") @Override public String getName() { return name; } /** * @return The value of the {@code description} attribute */ @JsonProperty("description") @Override public @Nullable String getDescription() { return description; } /** * @return The value of the {@code headers} attribute */ @JsonProperty("headers") @Override public AstBody.Headers getHeaders() { return headers; } /** * @return The value of the {@code bodyType} attribute */ @JsonProperty("bodyType") @Override public AstBody.AstBodyType getBodyType() { return bodyType; } /** * @return The value of the {@code messages} attribute */ @JsonProperty("messages") @Override public ImmutableList getMessages() { return messages; } /** * @return The value of the {@code beanType} attribute */ @JsonProperty("beanType") @JsonIgnore @Override public Class getBeanType() { return beanType; } /** * @return The value of the {@code value} attribute */ @JsonProperty("value") @Override public String getValue() { return value; } /** * @return The value of the {@code typeDef0} attribute */ @JsonProperty("typeDef0") @Override public @Nullable TypeDef getTypeDef0() { return typeDef0; } /** * @return The value of the {@code typeDef1} attribute */ @JsonProperty("typeDef1") @Override public @Nullable TypeDef getTypeDef1() { return typeDef1; } /** * @return The value of the {@code returnDef1} attribute */ @JsonProperty("returnDef1") @Override public @Nullable TypeDef getReturnDef1() { return returnDef1; } /** * @return The value of the {@code refs} attribute */ @JsonProperty("refs") @Override public ImmutableList getRefs() { return refs; } /** * @return The value of the {@code executorType} attribute */ @JsonProperty("executorType") @Override public AstService.AstServiceType getExecutorType() { return executorType; } /** * Copy the current immutable object by setting a value for the {@link AstService#getName() name} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for name * @return A modified copy of the {@code this} object */ public final ImmutableAstService withName(String value) { String newValue = Objects.requireNonNull(value, "name"); if (this.name.equals(newValue)) return this; return new ImmutableAstService( newValue, this.description, this.headers, this.bodyType, this.messages, this.beanType, this.value, this.typeDef0, this.typeDef1, this.returnDef1, this.refs, this.executorType); } /** * Copy the current immutable object by setting a value for the {@link AstService#getDescription() description} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for description (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableAstService withDescription(@Nullable String value) { if (Objects.equals(this.description, value)) return this; return new ImmutableAstService( this.name, value, this.headers, this.bodyType, this.messages, this.beanType, this.value, this.typeDef0, this.typeDef1, this.returnDef1, this.refs, this.executorType); } /** * Copy the current immutable object by setting a value for the {@link AstService#getHeaders() headers} 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 headers * @return A modified copy of the {@code this} object */ public final ImmutableAstService withHeaders(AstBody.Headers value) { if (this.headers == value) return this; AstBody.Headers newValue = Objects.requireNonNull(value, "headers"); return new ImmutableAstService( this.name, this.description, newValue, this.bodyType, this.messages, this.beanType, this.value, this.typeDef0, this.typeDef1, this.returnDef1, this.refs, this.executorType); } /** * Copy the current immutable object by setting a value for the {@link AstService#getBodyType() bodyType} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for bodyType * @return A modified copy of the {@code this} object */ public final ImmutableAstService withBodyType(AstBody.AstBodyType value) { if (this.bodyType == value) return this; AstBody.AstBodyType newValue = Objects.requireNonNull(value, "bodyType"); if (this.bodyType.equals(newValue)) return this; return new ImmutableAstService( this.name, this.description, this.headers, newValue, this.messages, this.beanType, this.value, this.typeDef0, this.typeDef1, this.returnDef1, this.refs, this.executorType); } /** * Copy the current immutable object with elements that replace the content of {@link AstService#getMessages() messages}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableAstService withMessages(AstBody.AstCommandMessage... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableAstService( this.name, this.description, this.headers, this.bodyType, newValue, this.beanType, this.value, this.typeDef0, this.typeDef1, this.returnDef1, this.refs, this.executorType); } /** * Copy the current immutable object with elements that replace the content of {@link AstService#getMessages() messages}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of messages elements to set * @return A modified copy of {@code this} object */ public final ImmutableAstService withMessages(Iterable elements) { if (this.messages == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableAstService( this.name, this.description, this.headers, this.bodyType, newValue, this.beanType, this.value, this.typeDef0, this.typeDef1, this.returnDef1, this.refs, this.executorType); } /** * Copy the current immutable object by setting a value for the {@link AstService#getBeanType() beanType} 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 beanType * @return A modified copy of the {@code this} object */ public final ImmutableAstService withBeanType(Class value) { if (this.beanType == value) return this; Class newValue = Objects.requireNonNull(value, "beanType"); return new ImmutableAstService( this.name, this.description, this.headers, this.bodyType, this.messages, newValue, this.value, this.typeDef0, this.typeDef1, this.returnDef1, this.refs, this.executorType); } /** * Copy the current immutable object by setting a value for the {@link AstService#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 * @return A modified copy of the {@code this} object */ public final ImmutableAstService withValue(String value) { String newValue = Objects.requireNonNull(value, "value"); if (this.value.equals(newValue)) return this; return new ImmutableAstService( this.name, this.description, this.headers, this.bodyType, this.messages, this.beanType, newValue, this.typeDef0, this.typeDef1, this.returnDef1, this.refs, this.executorType); } /** * Copy the current immutable object by setting a value for the {@link AstService#getTypeDef0() typeDef0} 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 typeDef0 (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableAstService withTypeDef0(@Nullable TypeDef value) { if (this.typeDef0 == value) return this; return new ImmutableAstService( this.name, this.description, this.headers, this.bodyType, this.messages, this.beanType, this.value, value, this.typeDef1, this.returnDef1, this.refs, this.executorType); } /** * Copy the current immutable object by setting a value for the {@link AstService#getTypeDef1() typeDef1} 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 typeDef1 (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableAstService withTypeDef1(@Nullable TypeDef value) { if (this.typeDef1 == value) return this; return new ImmutableAstService( this.name, this.description, this.headers, this.bodyType, this.messages, this.beanType, this.value, this.typeDef0, value, this.returnDef1, this.refs, this.executorType); } /** * Copy the current immutable object by setting a value for the {@link AstService#getReturnDef1() returnDef1} 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 returnDef1 (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableAstService withReturnDef1(@Nullable TypeDef value) { if (this.returnDef1 == value) return this; return new ImmutableAstService( this.name, this.description, this.headers, this.bodyType, this.messages, this.beanType, this.value, this.typeDef0, this.typeDef1, value, this.refs, this.executorType); } /** * Copy the current immutable object with elements that replace the content of {@link AstService#getRefs() refs}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableAstService withRefs(AstService.AstServiceRef... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableAstService( this.name, this.description, this.headers, this.bodyType, this.messages, this.beanType, this.value, this.typeDef0, this.typeDef1, this.returnDef1, newValue, this.executorType); } /** * Copy the current immutable object with elements that replace the content of {@link AstService#getRefs() refs}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of refs elements to set * @return A modified copy of {@code this} object */ public final ImmutableAstService withRefs(Iterable elements) { if (this.refs == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableAstService( this.name, this.description, this.headers, this.bodyType, this.messages, this.beanType, this.value, this.typeDef0, this.typeDef1, this.returnDef1, newValue, this.executorType); } /** * Copy the current immutable object by setting a value for the {@link AstService#getExecutorType() executorType} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for executorType * @return A modified copy of the {@code this} object */ public final ImmutableAstService withExecutorType(AstService.AstServiceType value) { if (this.executorType == value) return this; AstService.AstServiceType newValue = Objects.requireNonNull(value, "executorType"); if (this.executorType.equals(newValue)) return this; return new ImmutableAstService( this.name, this.description, this.headers, this.bodyType, this.messages, this.beanType, this.value, this.typeDef0, this.typeDef1, this.returnDef1, this.refs, newValue); } /** * This instance is equal to all instances of {@code ImmutableAstService} 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 ImmutableAstService && equalTo((ImmutableAstService) another); } private boolean equalTo(ImmutableAstService another) { return name.equals(another.name) && Objects.equals(description, another.description) && headers.equals(another.headers) && bodyType.equals(another.bodyType) && messages.equals(another.messages) && beanType.equals(another.beanType) && value.equals(another.value) && Objects.equals(typeDef0, another.typeDef0) && Objects.equals(typeDef1, another.typeDef1) && Objects.equals(returnDef1, another.returnDef1) && refs.equals(another.refs) && executorType.equals(another.executorType); } /** * Computes a hash code from attributes: {@code name}, {@code description}, {@code headers}, {@code bodyType}, {@code messages}, {@code beanType}, {@code value}, {@code typeDef0}, {@code typeDef1}, {@code returnDef1}, {@code refs}, {@code executorType}. * @return hashCode value */ @Override public int hashCode() { @Var int h = 5381; h += (h << 5) + name.hashCode(); h += (h << 5) + Objects.hashCode(description); h += (h << 5) + headers.hashCode(); h += (h << 5) + bodyType.hashCode(); h += (h << 5) + messages.hashCode(); h += (h << 5) + beanType.hashCode(); h += (h << 5) + value.hashCode(); h += (h << 5) + Objects.hashCode(typeDef0); h += (h << 5) + Objects.hashCode(typeDef1); h += (h << 5) + Objects.hashCode(returnDef1); h += (h << 5) + refs.hashCode(); h += (h << 5) + executorType.hashCode(); return h; } /** * Prints the immutable value {@code AstService} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("AstService") .omitNullValues() .add("name", name) .add("description", description) .add("headers", headers) .add("bodyType", bodyType) .add("messages", messages) .add("beanType", beanType) .add("value", value) .add("typeDef0", typeDef0) .add("typeDef1", typeDef1) .add("returnDef1", returnDef1) .add("refs", refs) .add("executorType", executorType) .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 = "AstService", generator = "Immutables") @Deprecated @SuppressWarnings("Immutable") @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements AstService { @Nullable String name; @Nullable String description; @Nullable AstBody.Headers headers; @Nullable AstBody.AstBodyType bodyType; @Nullable List messages = ImmutableList.of(); @Nullable Class beanType; @Nullable String value; @Nullable TypeDef typeDef0; @Nullable TypeDef typeDef1; @Nullable TypeDef returnDef1; @Nullable List refs = ImmutableList.of(); @Nullable AstService.AstServiceType executorType; @JsonProperty("name") public void setName(String name) { this.name = name; } @JsonProperty("description") public void setDescription(@Nullable String description) { this.description = description; } @JsonProperty("headers") public void setHeaders(AstBody.Headers headers) { this.headers = headers; } @JsonProperty("bodyType") public void setBodyType(AstBody.AstBodyType bodyType) { this.bodyType = bodyType; } @JsonProperty("messages") public void setMessages(List messages) { this.messages = messages; } @JsonProperty("beanType") @JsonIgnore public void setBeanType(Class beanType) { this.beanType = beanType; } @JsonProperty("value") public void setValue(String value) { this.value = value; } @JsonProperty("typeDef0") public void setTypeDef0(@Nullable TypeDef typeDef0) { this.typeDef0 = typeDef0; } @JsonProperty("typeDef1") public void setTypeDef1(@Nullable TypeDef typeDef1) { this.typeDef1 = typeDef1; } @JsonProperty("returnDef1") public void setReturnDef1(@Nullable TypeDef returnDef1) { this.returnDef1 = returnDef1; } @JsonProperty("refs") public void setRefs(List refs) { this.refs = refs; } @JsonProperty("executorType") public void setExecutorType(AstService.AstServiceType executorType) { this.executorType = executorType; } @Override public String getName() { throw new UnsupportedOperationException(); } @Override public String getDescription() { throw new UnsupportedOperationException(); } @Override public AstBody.Headers getHeaders() { throw new UnsupportedOperationException(); } @Override public AstBody.AstBodyType getBodyType() { throw new UnsupportedOperationException(); } @Override public List getMessages() { throw new UnsupportedOperationException(); } @Override public Class getBeanType() { throw new UnsupportedOperationException(); } @Override public String getValue() { throw new UnsupportedOperationException(); } @Override public TypeDef getTypeDef0() { throw new UnsupportedOperationException(); } @Override public TypeDef getTypeDef1() { throw new UnsupportedOperationException(); } @Override public TypeDef getReturnDef1() { throw new UnsupportedOperationException(); } @Override public List getRefs() { throw new UnsupportedOperationException(); } @Override public AstService.AstServiceType getExecutorType() { 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 ImmutableAstService fromJson(Json json) { ImmutableAstService.Builder builder = ImmutableAstService.builder(); if (json.name != null) { builder.name(json.name); } if (json.description != null) { builder.description(json.description); } if (json.headers != null) { builder.headers(json.headers); } if (json.bodyType != null) { builder.bodyType(json.bodyType); } if (json.messages != null) { builder.addAllMessages(json.messages); } if (json.beanType != null) { builder.beanType(json.beanType); } if (json.value != null) { builder.value(json.value); } if (json.typeDef0 != null) { builder.typeDef0(json.typeDef0); } if (json.typeDef1 != null) { builder.typeDef1(json.typeDef1); } if (json.returnDef1 != null) { builder.returnDef1(json.returnDef1); } if (json.refs != null) { builder.addAllRefs(json.refs); } if (json.executorType != null) { builder.executorType(json.executorType); } return builder.build(); } /** * Creates an immutable copy of a {@link AstService} 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 AstService instance */ public static ImmutableAstService copyOf(AstService instance) { if (instance instanceof ImmutableAstService) { return (ImmutableAstService) instance; } return ImmutableAstService.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableAstService ImmutableAstService}. *

   * ImmutableAstService.builder()
   *    .name(String) // required {@link AstService#getName() name}
   *    .description(String | null) // nullable {@link AstService#getDescription() description}
   *    .headers(io.resys.hdes.client.api.ast.AstBody.Headers) // required {@link AstService#getHeaders() headers}
   *    .bodyType(io.resys.hdes.client.api.ast.AstBody.AstBodyType) // required {@link AstService#getBodyType() bodyType}
   *    .addMessages|addAllMessages(io.resys.hdes.client.api.ast.AstBody.AstCommandMessage) // {@link AstService#getMessages() messages} elements
   *    .beanType(Class&lt;? extends io.resys.hdes.client.api.ast.AstService.ServiceExecutorType&gt;) // required {@link AstService#getBeanType() beanType}
   *    .value(String) // required {@link AstService#getValue() value}
   *    .typeDef0(io.resys.hdes.client.api.ast.TypeDef | null) // nullable {@link AstService#getTypeDef0() typeDef0}
   *    .typeDef1(io.resys.hdes.client.api.ast.TypeDef | null) // nullable {@link AstService#getTypeDef1() typeDef1}
   *    .returnDef1(io.resys.hdes.client.api.ast.TypeDef | null) // nullable {@link AstService#getReturnDef1() returnDef1}
   *    .addRefs|addAllRefs(io.resys.hdes.client.api.ast.AstService.AstServiceRef) // {@link AstService#getRefs() refs} elements
   *    .executorType(io.resys.hdes.client.api.ast.AstService.AstServiceType) // required {@link AstService#getExecutorType() executorType}
   *    .build();
   * 
* @return A new ImmutableAstService builder */ public static ImmutableAstService.Builder builder() { return new ImmutableAstService.Builder(); } /** * Builds instances of type {@link ImmutableAstService ImmutableAstService}. * 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 = "AstService", generator = "Immutables") @NotThreadSafe public static final class Builder { private static final long INIT_BIT_NAME = 0x1L; private static final long INIT_BIT_HEADERS = 0x2L; private static final long INIT_BIT_BODY_TYPE = 0x4L; private static final long INIT_BIT_BEAN_TYPE = 0x8L; private static final long INIT_BIT_VALUE = 0x10L; private static final long INIT_BIT_EXECUTOR_TYPE = 0x20L; private long initBits = 0x3fL; private @Nullable String name; private @Nullable String description; private @Nullable AstBody.Headers headers; private @Nullable AstBody.AstBodyType bodyType; private ImmutableList.Builder messages = ImmutableList.builder(); private @Nullable Class beanType; private @Nullable String value; private @Nullable TypeDef typeDef0; private @Nullable TypeDef typeDef1; private @Nullable TypeDef returnDef1; private ImmutableList.Builder refs = ImmutableList.builder(); private @Nullable AstService.AstServiceType executorType; private Builder() { } /** * Fill a builder with attribute values from the provided {@code io.resys.hdes.client.api.ast.AstService} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder from(AstService instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return this; } /** * Fill a builder with attribute values from the provided {@code io.resys.hdes.client.api.ast.AstBody} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder from(AstBody instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return this; } private void from(Object object) { if (object instanceof AstService) { AstService instance = (AstService) object; @Nullable TypeDef returnDef1Value = instance.getReturnDef1(); if (returnDef1Value != null) { returnDef1(returnDef1Value); } executorType(instance.getExecutorType()); addAllRefs(instance.getRefs()); value(instance.getValue()); @Nullable TypeDef typeDef0Value = instance.getTypeDef0(); if (typeDef0Value != null) { typeDef0(typeDef0Value); } beanType(instance.getBeanType()); @Nullable TypeDef typeDef1Value = instance.getTypeDef1(); if (typeDef1Value != null) { typeDef1(typeDef1Value); } } if (object instanceof AstBody) { AstBody instance = (AstBody) object; bodyType(instance.getBodyType()); name(instance.getName()); headers(instance.getHeaders()); @Nullable String descriptionValue = instance.getDescription(); if (descriptionValue != null) { description(descriptionValue); } addAllMessages(instance.getMessages()); } } /** * Initializes the value for the {@link AstService#getName() name} attribute. * @param name The value for name * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("name") public final Builder name(String name) { this.name = Objects.requireNonNull(name, "name"); initBits &= ~INIT_BIT_NAME; return this; } /** * Initializes the value for the {@link AstService#getDescription() description} attribute. * @param description The value for description (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("description") public final Builder description(@Nullable String description) { this.description = description; return this; } /** * Initializes the value for the {@link AstService#getHeaders() headers} attribute. * @param headers The value for headers * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("headers") public final Builder headers(AstBody.Headers headers) { this.headers = Objects.requireNonNull(headers, "headers"); initBits &= ~INIT_BIT_HEADERS; return this; } /** * Initializes the value for the {@link AstService#getBodyType() bodyType} attribute. * @param bodyType The value for bodyType * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("bodyType") public final Builder bodyType(AstBody.AstBodyType bodyType) { this.bodyType = Objects.requireNonNull(bodyType, "bodyType"); initBits &= ~INIT_BIT_BODY_TYPE; return this; } /** * Adds one element to {@link AstService#getMessages() messages} list. * @param element A messages element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addMessages(AstBody.AstCommandMessage element) { this.messages.add(element); return this; } /** * Adds elements to {@link AstService#getMessages() messages} list. * @param elements An array of messages elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addMessages(AstBody.AstCommandMessage... elements) { this.messages.add(elements); return this; } /** * Sets or replaces all elements for {@link AstService#getMessages() messages} list. * @param elements An iterable of messages elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("messages") public final Builder messages(Iterable elements) { this.messages = ImmutableList.builder(); return addAllMessages(elements); } /** * Adds elements to {@link AstService#getMessages() messages} list. * @param elements An iterable of messages elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addAllMessages(Iterable elements) { this.messages.addAll(elements); return this; } /** * Initializes the value for the {@link AstService#getBeanType() beanType} attribute. * @param beanType The value for beanType * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("beanType") @JsonIgnore public final Builder beanType(Class beanType) { this.beanType = Objects.requireNonNull(beanType, "beanType"); initBits &= ~INIT_BIT_BEAN_TYPE; return this; } /** * Initializes the value for the {@link AstService#getValue() value} attribute. * @param value The value for value * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("value") public final Builder value(String value) { this.value = Objects.requireNonNull(value, "value"); initBits &= ~INIT_BIT_VALUE; return this; } /** * Initializes the value for the {@link AstService#getTypeDef0() typeDef0} attribute. * @param typeDef0 The value for typeDef0 (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("typeDef0") public final Builder typeDef0(@Nullable TypeDef typeDef0) { this.typeDef0 = typeDef0; return this; } /** * Initializes the value for the {@link AstService#getTypeDef1() typeDef1} attribute. * @param typeDef1 The value for typeDef1 (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("typeDef1") public final Builder typeDef1(@Nullable TypeDef typeDef1) { this.typeDef1 = typeDef1; return this; } /** * Initializes the value for the {@link AstService#getReturnDef1() returnDef1} attribute. * @param returnDef1 The value for returnDef1 (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("returnDef1") public final Builder returnDef1(@Nullable TypeDef returnDef1) { this.returnDef1 = returnDef1; return this; } /** * Adds one element to {@link AstService#getRefs() refs} list. * @param element A refs element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addRefs(AstService.AstServiceRef element) { this.refs.add(element); return this; } /** * Adds elements to {@link AstService#getRefs() refs} list. * @param elements An array of refs elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addRefs(AstService.AstServiceRef... elements) { this.refs.add(elements); return this; } /** * Sets or replaces all elements for {@link AstService#getRefs() refs} list. * @param elements An iterable of refs elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("refs") public final Builder refs(Iterable elements) { this.refs = ImmutableList.builder(); return addAllRefs(elements); } /** * Adds elements to {@link AstService#getRefs() refs} list. * @param elements An iterable of refs elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addAllRefs(Iterable elements) { this.refs.addAll(elements); return this; } /** * Initializes the value for the {@link AstService#getExecutorType() executorType} attribute. * @param executorType The value for executorType * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("executorType") public final Builder executorType(AstService.AstServiceType executorType) { this.executorType = Objects.requireNonNull(executorType, "executorType"); initBits &= ~INIT_BIT_EXECUTOR_TYPE; return this; } /** * Builds a new {@link ImmutableAstService ImmutableAstService}. * @return An immutable instance of AstService * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableAstService build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableAstService( name, description, headers, bodyType, messages.build(), beanType, value, typeDef0, typeDef1, returnDef1, refs.build(), executorType); } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if ((initBits & INIT_BIT_NAME) != 0) attributes.add("name"); if ((initBits & INIT_BIT_HEADERS) != 0) attributes.add("headers"); if ((initBits & INIT_BIT_BODY_TYPE) != 0) attributes.add("bodyType"); if ((initBits & INIT_BIT_BEAN_TYPE) != 0) attributes.add("beanType"); if ((initBits & INIT_BIT_VALUE) != 0) attributes.add("value"); if ((initBits & INIT_BIT_EXECUTOR_TYPE) != 0) attributes.add("executorType"); return "Cannot build AstService, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy