io.protostuff.generator.html.json.message.ImmutableMessageField Maven / Gradle / Ivy
package io.protostuff.generator.html.json.message;
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.common.collect.ImmutableMap;
import com.google.common.primitives.Booleans;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.Var;
import java.util.ArrayList;
import java.util.List;
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;
/**
* Immutable implementation of {@link MessageField}.
*
* Use the builder to create immutable instances:
* {@code ImmutableMessageField.builder()}.
*/
@Generated(from = "MessageField", generator = "Immutables")
@SuppressWarnings({"all"})
@ParametersAreNonnullByDefault
@javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutableMessageField implements MessageField {
private final String name;
private final String typeId;
private final MessageFieldModifier modifier;
private final int tag;
private final @Nullable String description;
private final boolean map;
private final @Nullable String mapKeyTypeId;
private final @Nullable String mapValueTypeId;
private final @Nullable String oneof;
private final ImmutableMap options;
private ImmutableMessageField(ImmutableMessageField.Builder builder) {
this.name = builder.name;
this.typeId = builder.typeId;
this.modifier = builder.modifier;
this.tag = builder.tag;
this.description = builder.description;
this.mapKeyTypeId = builder.mapKeyTypeId;
this.mapValueTypeId = builder.mapValueTypeId;
this.oneof = builder.oneof;
this.options = builder.options.build();
this.map = builder.mapIsSet()
? builder.map
: MessageField.super.map();
}
private ImmutableMessageField(
String name,
String typeId,
MessageFieldModifier modifier,
int tag,
@Nullable String description,
boolean map,
@Nullable String mapKeyTypeId,
@Nullable String mapValueTypeId,
@Nullable String oneof,
ImmutableMap options) {
this.name = name;
this.typeId = typeId;
this.modifier = modifier;
this.tag = tag;
this.description = description;
this.map = map;
this.mapKeyTypeId = mapKeyTypeId;
this.mapValueTypeId = mapValueTypeId;
this.oneof = oneof;
this.options = options;
}
/**
* @return The value of the {@code name} attribute
*/
@JsonProperty("name")
@Override
public String name() {
return name;
}
/**
* @return The value of the {@code typeId} attribute
*/
@JsonProperty("typeId")
@Override
public String typeId() {
return typeId;
}
/**
* @return The value of the {@code modifier} attribute
*/
@JsonProperty("modifier")
@Override
public MessageFieldModifier modifier() {
return modifier;
}
/**
* @return The value of the {@code tag} attribute
*/
@JsonProperty("tag")
@Override
public int tag() {
return tag;
}
/**
* @return The value of the {@code description} attribute
*/
@JsonProperty("description")
@Override
public @Nullable String description() {
return description;
}
/**
* @return The value of the {@code map} attribute
*/
@JsonProperty("map")
@Override
public boolean map() {
return map;
}
/**
* @return The value of the {@code mapKeyTypeId} attribute
*/
@JsonProperty("mapKeyTypeId")
@Override
public @Nullable String mapKeyTypeId() {
return mapKeyTypeId;
}
/**
* @return The value of the {@code mapValueTypeId} attribute
*/
@JsonProperty("mapValueTypeId")
@Override
public @Nullable String mapValueTypeId() {
return mapValueTypeId;
}
/**
* @return The value of the {@code oneof} attribute
*/
@JsonProperty("oneof")
@Override
public @Nullable String oneof() {
return oneof;
}
/**
* @return The value of the {@code options} attribute
*/
@JsonProperty("options")
@Override
public ImmutableMap options() {
return options;
}
/**
* Copy the current immutable object by setting a value for the {@link MessageField#name() 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 ImmutableMessageField withName(String value) {
String newValue = Objects.requireNonNull(value, "name");
if (this.name.equals(newValue)) return this;
return new ImmutableMessageField(
newValue,
this.typeId,
this.modifier,
this.tag,
this.description,
this.map,
this.mapKeyTypeId,
this.mapValueTypeId,
this.oneof,
this.options);
}
/**
* Copy the current immutable object by setting a value for the {@link MessageField#typeId() typeId} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for typeId
* @return A modified copy of the {@code this} object
*/
public final ImmutableMessageField withTypeId(String value) {
String newValue = Objects.requireNonNull(value, "typeId");
if (this.typeId.equals(newValue)) return this;
return new ImmutableMessageField(
this.name,
newValue,
this.modifier,
this.tag,
this.description,
this.map,
this.mapKeyTypeId,
this.mapValueTypeId,
this.oneof,
this.options);
}
/**
* Copy the current immutable object by setting a value for the {@link MessageField#modifier() modifier} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for modifier
* @return A modified copy of the {@code this} object
*/
public final ImmutableMessageField withModifier(MessageFieldModifier value) {
if (this.modifier == value) return this;
MessageFieldModifier newValue = Objects.requireNonNull(value, "modifier");
if (this.modifier.equals(newValue)) return this;
return new ImmutableMessageField(
this.name,
this.typeId,
newValue,
this.tag,
this.description,
this.map,
this.mapKeyTypeId,
this.mapValueTypeId,
this.oneof,
this.options);
}
/**
* Copy the current immutable object by setting a value for the {@link MessageField#tag() tag} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for tag
* @return A modified copy of the {@code this} object
*/
public final ImmutableMessageField withTag(int value) {
if (this.tag == value) return this;
return new ImmutableMessageField(
this.name,
this.typeId,
this.modifier,
value,
this.description,
this.map,
this.mapKeyTypeId,
this.mapValueTypeId,
this.oneof,
this.options);
}
/**
* Copy the current immutable object by setting a value for the {@link MessageField#description() 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 ImmutableMessageField withDescription(@Nullable String value) {
if (Objects.equals(this.description, value)) return this;
return new ImmutableMessageField(
this.name,
this.typeId,
this.modifier,
this.tag,
value,
this.map,
this.mapKeyTypeId,
this.mapValueTypeId,
this.oneof,
this.options);
}
/**
* Copy the current immutable object by setting a value for the {@link MessageField#map() map} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for map
* @return A modified copy of the {@code this} object
*/
public final ImmutableMessageField withMap(boolean value) {
if (this.map == value) return this;
return new ImmutableMessageField(
this.name,
this.typeId,
this.modifier,
this.tag,
this.description,
value,
this.mapKeyTypeId,
this.mapValueTypeId,
this.oneof,
this.options);
}
/**
* Copy the current immutable object by setting a value for the {@link MessageField#mapKeyTypeId() mapKeyTypeId} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for mapKeyTypeId (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableMessageField withMapKeyTypeId(@Nullable String value) {
if (Objects.equals(this.mapKeyTypeId, value)) return this;
return new ImmutableMessageField(
this.name,
this.typeId,
this.modifier,
this.tag,
this.description,
this.map,
value,
this.mapValueTypeId,
this.oneof,
this.options);
}
/**
* Copy the current immutable object by setting a value for the {@link MessageField#mapValueTypeId() mapValueTypeId} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for mapValueTypeId (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableMessageField withMapValueTypeId(@Nullable String value) {
if (Objects.equals(this.mapValueTypeId, value)) return this;
return new ImmutableMessageField(
this.name,
this.typeId,
this.modifier,
this.tag,
this.description,
this.map,
this.mapKeyTypeId,
value,
this.oneof,
this.options);
}
/**
* Copy the current immutable object by setting a value for the {@link MessageField#oneof() oneof} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for oneof (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableMessageField withOneof(@Nullable String value) {
if (Objects.equals(this.oneof, value)) return this;
return new ImmutableMessageField(
this.name,
this.typeId,
this.modifier,
this.tag,
this.description,
this.map,
this.mapKeyTypeId,
this.mapValueTypeId,
value,
this.options);
}
/**
* Copy the current immutable object by replacing the {@link MessageField#options() options} 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 options map
* @return A modified copy of {@code this} object
*/
public final ImmutableMessageField withOptions(Map entries) {
if (this.options == entries) return this;
ImmutableMap newValue = ImmutableMap.copyOf(entries);
return new ImmutableMessageField(
this.name,
this.typeId,
this.modifier,
this.tag,
this.description,
this.map,
this.mapKeyTypeId,
this.mapValueTypeId,
this.oneof,
newValue);
}
/**
* This instance is equal to all instances of {@code ImmutableMessageField} 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 ImmutableMessageField
&& equalTo((ImmutableMessageField) another);
}
private boolean equalTo(ImmutableMessageField another) {
return name.equals(another.name)
&& typeId.equals(another.typeId)
&& modifier.equals(another.modifier)
&& tag == another.tag
&& Objects.equals(description, another.description)
&& map == another.map
&& Objects.equals(mapKeyTypeId, another.mapKeyTypeId)
&& Objects.equals(mapValueTypeId, another.mapValueTypeId)
&& Objects.equals(oneof, another.oneof)
&& options.equals(another.options);
}
/**
* Computes a hash code from attributes: {@code name}, {@code typeId}, {@code modifier}, {@code tag}, {@code description}, {@code map}, {@code mapKeyTypeId}, {@code mapValueTypeId}, {@code oneof}, {@code options}.
* @return hashCode value
*/
@Override
public int hashCode() {
@Var int h = 5381;
h += (h << 5) + name.hashCode();
h += (h << 5) + typeId.hashCode();
h += (h << 5) + modifier.hashCode();
h += (h << 5) + tag;
h += (h << 5) + Objects.hashCode(description);
h += (h << 5) + Booleans.hashCode(map);
h += (h << 5) + Objects.hashCode(mapKeyTypeId);
h += (h << 5) + Objects.hashCode(mapValueTypeId);
h += (h << 5) + Objects.hashCode(oneof);
h += (h << 5) + options.hashCode();
return h;
}
/**
* Prints the immutable value {@code MessageField} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("MessageField")
.omitNullValues()
.add("name", name)
.add("typeId", typeId)
.add("modifier", modifier)
.add("tag", tag)
.add("description", description)
.add("map", map)
.add("mapKeyTypeId", mapKeyTypeId)
.add("mapValueTypeId", mapValueTypeId)
.add("oneof", oneof)
.add("options", options)
.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 = "MessageField", generator = "Immutables")
@Deprecated
@SuppressWarnings("Immutable")
@JsonDeserialize
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json implements MessageField {
@Nullable String name;
@Nullable String typeId;
@Nullable MessageFieldModifier modifier;
int tag;
boolean tagIsSet;
@Nullable String description;
boolean map;
boolean mapIsSet;
@Nullable String mapKeyTypeId;
@Nullable String mapValueTypeId;
@Nullable String oneof;
@Nullable Map options = ImmutableMap.of();
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
@JsonProperty("typeId")
public void setTypeId(String typeId) {
this.typeId = typeId;
}
@JsonProperty("modifier")
public void setModifier(MessageFieldModifier modifier) {
this.modifier = modifier;
}
@JsonProperty("tag")
public void setTag(int tag) {
this.tag = tag;
this.tagIsSet = true;
}
@JsonProperty("description")
public void setDescription(@Nullable String description) {
this.description = description;
}
@JsonProperty("map")
public void setMap(boolean map) {
this.map = map;
this.mapIsSet = true;
}
@JsonProperty("mapKeyTypeId")
public void setMapKeyTypeId(@Nullable String mapKeyTypeId) {
this.mapKeyTypeId = mapKeyTypeId;
}
@JsonProperty("mapValueTypeId")
public void setMapValueTypeId(@Nullable String mapValueTypeId) {
this.mapValueTypeId = mapValueTypeId;
}
@JsonProperty("oneof")
public void setOneof(@Nullable String oneof) {
this.oneof = oneof;
}
@JsonProperty("options")
public void setOptions(Map options) {
this.options = options;
}
@Override
public String name() { throw new UnsupportedOperationException(); }
@Override
public String typeId() { throw new UnsupportedOperationException(); }
@Override
public MessageFieldModifier modifier() { throw new UnsupportedOperationException(); }
@Override
public int tag() { throw new UnsupportedOperationException(); }
@Override
public String description() { throw new UnsupportedOperationException(); }
@Override
public boolean map() { throw new UnsupportedOperationException(); }
@Override
public String mapKeyTypeId() { throw new UnsupportedOperationException(); }
@Override
public String mapValueTypeId() { throw new UnsupportedOperationException(); }
@Override
public String oneof() { throw new UnsupportedOperationException(); }
@Override
public Map options() { 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 ImmutableMessageField fromJson(Json json) {
ImmutableMessageField.Builder builder = ImmutableMessageField.builder();
if (json.name != null) {
builder.name(json.name);
}
if (json.typeId != null) {
builder.typeId(json.typeId);
}
if (json.modifier != null) {
builder.modifier(json.modifier);
}
if (json.tagIsSet) {
builder.tag(json.tag);
}
if (json.description != null) {
builder.description(json.description);
}
if (json.mapIsSet) {
builder.map(json.map);
}
if (json.mapKeyTypeId != null) {
builder.mapKeyTypeId(json.mapKeyTypeId);
}
if (json.mapValueTypeId != null) {
builder.mapValueTypeId(json.mapValueTypeId);
}
if (json.oneof != null) {
builder.oneof(json.oneof);
}
if (json.options != null) {
builder.putAllOptions(json.options);
}
return builder.build();
}
/**
* Creates an immutable copy of a {@link MessageField} 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 MessageField instance
*/
public static ImmutableMessageField copyOf(MessageField instance) {
if (instance instanceof ImmutableMessageField) {
return (ImmutableMessageField) instance;
}
return ImmutableMessageField.builder()
.from(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableMessageField ImmutableMessageField}.
*
* ImmutableMessageField.builder()
* .name(String) // required {@link MessageField#name() name}
* .typeId(String) // required {@link MessageField#typeId() typeId}
* .modifier(io.protostuff.generator.html.json.message.MessageFieldModifier) // required {@link MessageField#modifier() modifier}
* .tag(int) // required {@link MessageField#tag() tag}
* .description(String | null) // nullable {@link MessageField#description() description}
* .map(boolean) // optional {@link MessageField#map() map}
* .mapKeyTypeId(String | null) // nullable {@link MessageField#mapKeyTypeId() mapKeyTypeId}
* .mapValueTypeId(String | null) // nullable {@link MessageField#mapValueTypeId() mapValueTypeId}
* .oneof(String | null) // nullable {@link MessageField#oneof() oneof}
* .putOptions|putAllOptions(String => Object) // {@link MessageField#options() options} mappings
* .build();
*
* @return A new ImmutableMessageField builder
*/
public static ImmutableMessageField.Builder builder() {
return new ImmutableMessageField.Builder();
}
/**
* Builds instances of type {@link ImmutableMessageField ImmutableMessageField}.
* 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 = "MessageField", generator = "Immutables")
@NotThreadSafe
public static final class Builder {
private static final long INIT_BIT_NAME = 0x1L;
private static final long INIT_BIT_TYPE_ID = 0x2L;
private static final long INIT_BIT_MODIFIER = 0x4L;
private static final long INIT_BIT_TAG = 0x8L;
private static final long OPT_BIT_MAP = 0x1L;
private long initBits = 0xfL;
private long optBits;
private @Nullable String name;
private @Nullable String typeId;
private @Nullable MessageFieldModifier modifier;
private int tag;
private @Nullable String description;
private boolean map;
private @Nullable String mapKeyTypeId;
private @Nullable String mapValueTypeId;
private @Nullable String oneof;
private ImmutableMap.Builder options = ImmutableMap.builder();
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code MessageField} 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(MessageField instance) {
Objects.requireNonNull(instance, "instance");
name(instance.name());
typeId(instance.typeId());
modifier(instance.modifier());
tag(instance.tag());
@Nullable String descriptionValue = instance.description();
if (descriptionValue != null) {
description(descriptionValue);
}
map(instance.map());
@Nullable String mapKeyTypeIdValue = instance.mapKeyTypeId();
if (mapKeyTypeIdValue != null) {
mapKeyTypeId(mapKeyTypeIdValue);
}
@Nullable String mapValueTypeIdValue = instance.mapValueTypeId();
if (mapValueTypeIdValue != null) {
mapValueTypeId(mapValueTypeIdValue);
}
@Nullable String oneofValue = instance.oneof();
if (oneofValue != null) {
oneof(oneofValue);
}
putAllOptions(instance.options());
return this;
}
/**
* Initializes the value for the {@link MessageField#name() 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 MessageField#typeId() typeId} attribute.
* @param typeId The value for typeId
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("typeId")
public final Builder typeId(String typeId) {
this.typeId = Objects.requireNonNull(typeId, "typeId");
initBits &= ~INIT_BIT_TYPE_ID;
return this;
}
/**
* Initializes the value for the {@link MessageField#modifier() modifier} attribute.
* @param modifier The value for modifier
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("modifier")
public final Builder modifier(MessageFieldModifier modifier) {
this.modifier = Objects.requireNonNull(modifier, "modifier");
initBits &= ~INIT_BIT_MODIFIER;
return this;
}
/**
* Initializes the value for the {@link MessageField#tag() tag} attribute.
* @param tag The value for tag
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("tag")
public final Builder tag(int tag) {
this.tag = tag;
initBits &= ~INIT_BIT_TAG;
return this;
}
/**
* Initializes the value for the {@link MessageField#description() 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 MessageField#map() map} attribute.
* If not set, this attribute will have a default value as returned by the initializer of {@link MessageField#map() map}.
* @param map The value for map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("map")
public final Builder map(boolean map) {
this.map = map;
optBits |= OPT_BIT_MAP;
return this;
}
/**
* Initializes the value for the {@link MessageField#mapKeyTypeId() mapKeyTypeId} attribute.
* @param mapKeyTypeId The value for mapKeyTypeId (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("mapKeyTypeId")
public final Builder mapKeyTypeId(@Nullable String mapKeyTypeId) {
this.mapKeyTypeId = mapKeyTypeId;
return this;
}
/**
* Initializes the value for the {@link MessageField#mapValueTypeId() mapValueTypeId} attribute.
* @param mapValueTypeId The value for mapValueTypeId (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("mapValueTypeId")
public final Builder mapValueTypeId(@Nullable String mapValueTypeId) {
this.mapValueTypeId = mapValueTypeId;
return this;
}
/**
* Initializes the value for the {@link MessageField#oneof() oneof} attribute.
* @param oneof The value for oneof (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("oneof")
public final Builder oneof(@Nullable String oneof) {
this.oneof = oneof;
return this;
}
/**
* Put one entry to the {@link MessageField#options() options} map.
* @param key The key in the options map
* @param value The associated value in the options map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putOptions(String key, Object value) {
this.options.put(key, value);
return this;
}
/**
* Put one entry to the {@link MessageField#options() options} 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 putOptions(Map.Entry entry) {
this.options.put(entry);
return this;
}
/**
* Sets or replaces all mappings from the specified map as entries for the {@link MessageField#options() options} map. Nulls are not permitted
* @param entries The entries that will be added to the options map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("options")
public final Builder options(Map entries) {
this.options = ImmutableMap.builder();
return putAllOptions(entries);
}
/**
* Put all mappings from the specified map as entries to {@link MessageField#options() options} map. Nulls are not permitted
* @param entries The entries that will be added to the options map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putAllOptions(Map entries) {
this.options.putAll(entries);
return this;
}
/**
* Builds a new {@link ImmutableMessageField ImmutableMessageField}.
* @return An immutable instance of MessageField
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableMessageField build() {
if (initBits != 0) {
throw new IllegalStateException(formatRequiredAttributesMessage());
}
return new ImmutableMessageField(this);
}
private boolean mapIsSet() {
return (optBits & OPT_BIT_MAP) != 0;
}
private String formatRequiredAttributesMessage() {
List attributes = new ArrayList<>();
if ((initBits & INIT_BIT_NAME) != 0) attributes.add("name");
if ((initBits & INIT_BIT_TYPE_ID) != 0) attributes.add("typeId");
if ((initBits & INIT_BIT_MODIFIER) != 0) attributes.add("modifier");
if ((initBits & INIT_BIT_TAG) != 0) attributes.add("tag");
return "Cannot build MessageField, some of required attributes are not set " + attributes;
}
}
}