Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.annotation.Generated;

Expand Down Expand Up @@ -65,6 +67,8 @@ public static Builder builder() {
public static final class Builder {
private boolean coin;

private boolean _coinInitialized = false;

private Builder() {}

public Builder from(BooleanExample other) {
Expand All @@ -75,10 +79,33 @@ public Builder from(BooleanExample other) {
@JsonSetter("coin")
public Builder coin(boolean coin) {
this.coin = coin;
this._coinInitialized = true;
return this;
}

private void validatePrimitiveFieldsHaveBeenInitialized() {
List<String> missingFields = null;
missingFields = addFieldIfMissing(missingFields, _coinInitialized, "coin");
if (missingFields != null) {
throw new IllegalArgumentException(
"Some required fields have not been set: " + missingFields);
}
}

private static List<String> addFieldIfMissing(
List<String> prev, boolean initialized, String fieldName) {
List<String> missingFields = prev;
if (!initialized) {
if (missingFields == null) {
missingFields = new ArrayList<>(1);
}
missingFields.add(fieldName);
}
return missingFields;
}

public BooleanExample build() {
validatePrimitiveFieldsHaveBeenInitialized();
return new BooleanExample(coin);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.annotation.Generated;

Expand Down Expand Up @@ -64,6 +66,8 @@ public static Builder builder() {
public static final class Builder {
private double doubleValue;

private boolean _doubleValueInitialized = false;

private Builder() {}

public Builder from(DoubleExample other) {
Expand All @@ -74,10 +78,34 @@ public Builder from(DoubleExample other) {
@JsonSetter("doubleValue")
public Builder doubleValue(double doubleValue) {
this.doubleValue = doubleValue;
this._doubleValueInitialized = true;
return this;
}

private void validatePrimitiveFieldsHaveBeenInitialized() {
List<String> missingFields = null;
missingFields =
addFieldIfMissing(missingFields, _doubleValueInitialized, "doubleValue");
if (missingFields != null) {
throw new IllegalArgumentException(
"Some required fields have not been set: " + missingFields);
}
}

private static List<String> addFieldIfMissing(
List<String> prev, boolean initialized, String fieldName) {
List<String> missingFields = prev;
if (!initialized) {
if (missingFields == null) {
missingFields = new ArrayList<>(1);
}
missingFields.add(fieldName);
}
return missingFields;
}

public DoubleExample build() {
validatePrimitiveFieldsHaveBeenInitialized();
return new DoubleExample(doubleValue);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.annotation.Generated;

Expand Down Expand Up @@ -65,6 +67,8 @@ public static Builder builder() {
public static final class Builder {
private int integer;

private boolean _integerInitialized = false;

private Builder() {}

public Builder from(IntegerExample other) {
Expand All @@ -75,10 +79,33 @@ public Builder from(IntegerExample other) {
@JsonSetter("integer")
public Builder integer(int integer) {
this.integer = integer;
this._integerInitialized = true;
return this;
}

private void validatePrimitiveFieldsHaveBeenInitialized() {
List<String> missingFields = null;
missingFields = addFieldIfMissing(missingFields, _integerInitialized, "integer");
if (missingFields != null) {
throw new IllegalArgumentException(
"Some required fields have not been set: " + missingFields);
}
}

private static List<String> addFieldIfMissing(
List<String> prev, boolean initialized, String fieldName) {
List<String> missingFields = prev;
if (!initialized) {
if (missingFields == null) {
missingFields = new ArrayList<>(1);
}
missingFields.add(fieldName);
}
return missingFields;
}

public IntegerExample build() {
validatePrimitiveFieldsHaveBeenInitialized();
return new IntegerExample(integer);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ public static final class Builder {

private StringAliasExample alias;

private boolean _integerInitialized = false;

private boolean _doubleValueInitialized = false;

private Builder() {}

public Builder from(ManyFieldExample other) {
Expand All @@ -251,13 +255,15 @@ public Builder string(String string) {
@JsonSetter("integer")
public Builder integer(int integer) {
this.integer = integer;
this._integerInitialized = true;
return this;
}

/** docs for doubleValue field */
@JsonSetter("doubleValue")
public Builder doubleValue(double doubleValue) {
this.doubleValue = doubleValue;
this._doubleValueInitialized = true;
return this;
}

Expand Down Expand Up @@ -345,7 +351,31 @@ public Builder alias(StringAliasExample alias) {
return this;
}

private void validatePrimitiveFieldsHaveBeenInitialized() {
List<String> missingFields = null;
missingFields = addFieldIfMissing(missingFields, _integerInitialized, "integer");
missingFields =
addFieldIfMissing(missingFields, _doubleValueInitialized, "doubleValue");
if (missingFields != null) {
throw new IllegalArgumentException(
"Some required fields have not been set: " + missingFields);
}
}

private static List<String> addFieldIfMissing(
List<String> prev, boolean initialized, String fieldName) {
List<String> missingFields = prev;
if (!initialized) {
if (missingFields == null) {
missingFields = new ArrayList<>(2);
}
missingFields.add(fieldName);
}
return missingFields;
}

public ManyFieldExample build() {
validatePrimitiveFieldsHaveBeenInitialized();
return new ManyFieldExample(
string, integer, doubleValue, optionalItem, items, set, map, alias);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ public static final class Builder {

private int memoizedHashCode_;

private boolean _memoizedHashCodeInitialized = false;

private Builder() {}

public Builder from(ReservedKeyExample other) {
Expand Down Expand Up @@ -169,10 +171,35 @@ public Builder fieldNameWithDashes(String fieldNameWithDashes) {
@JsonSetter("memoizedHashCode")
public Builder memoizedHashCode_(int memoizedHashCode_) {
this.memoizedHashCode_ = memoizedHashCode_;
this._memoizedHashCodeInitialized = true;
return this;
}

private void validatePrimitiveFieldsHaveBeenInitialized() {
List<String> missingFields = null;
missingFields =
addFieldIfMissing(
missingFields, _memoizedHashCodeInitialized, "memoizedHashCode");
if (missingFields != null) {
throw new IllegalArgumentException(
"Some required fields have not been set: " + missingFields);
}
}

private static List<String> addFieldIfMissing(
List<String> prev, boolean initialized, String fieldName) {
List<String> missingFields = prev;
if (!initialized) {
if (missingFields == null) {
missingFields = new ArrayList<>(1);
}
missingFields.add(fieldName);
}
return missingFields;
}

public ReservedKeyExample build() {
validatePrimitiveFieldsHaveBeenInitialized();
return new ReservedKeyExample(
package_, interface_, fieldNameWithDashes, memoizedHashCode_);
}
Expand Down
Loading