com.palantir.atlasdb.timelock.api.ConjureWaitForLocksResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of timelock-api-objects Show documentation
Show all versions of timelock-api-objects Show documentation
Palantir open source project
package com.palantir.atlasdb.timelock.api;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.errorprone.annotations.CheckReturnValue;
import com.palantir.logsafe.Preconditions;
import com.palantir.logsafe.Safe;
import com.palantir.logsafe.SafeArg;
import com.palantir.logsafe.exceptions.SafeIllegalArgumentException;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import javax.annotation.processing.Generated;
@Safe
@JsonDeserialize(builder = ConjureWaitForLocksResponse.Builder.class)
@Generated("com.palantir.conjure.java.types.BeanGenerator")
public final class ConjureWaitForLocksResponse {
private final boolean wasSuccessful;
private ConjureWaitForLocksResponse(boolean wasSuccessful) {
this.wasSuccessful = wasSuccessful;
}
@JsonProperty("wasSuccessful")
@Safe
public boolean getWasSuccessful() {
return this.wasSuccessful;
}
@Override
public boolean equals(@Nullable Object other) {
return this == other
|| (other instanceof ConjureWaitForLocksResponse && equalTo((ConjureWaitForLocksResponse) other));
}
private boolean equalTo(ConjureWaitForLocksResponse other) {
return this.wasSuccessful == other.wasSuccessful;
}
@Override
public int hashCode() {
return Boolean.hashCode(this.wasSuccessful);
}
@Override
@Safe
public String toString() {
return "ConjureWaitForLocksResponse{wasSuccessful: " + wasSuccessful + '}';
}
public static ConjureWaitForLocksResponse of(@Safe boolean wasSuccessful) {
return builder().wasSuccessful(wasSuccessful).build();
}
public static Builder builder() {
return new Builder();
}
@Generated("com.palantir.conjure.java.types.BeanBuilderGenerator")
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
boolean _buildInvoked;
private @Safe boolean wasSuccessful;
private boolean _wasSuccessfulInitialized = false;
private Builder() {}
public Builder from(ConjureWaitForLocksResponse other) {
checkNotBuilt();
wasSuccessful(other.getWasSuccessful());
return this;
}
@JsonSetter("wasSuccessful")
public Builder wasSuccessful(@Safe boolean wasSuccessful) {
checkNotBuilt();
this.wasSuccessful = wasSuccessful;
this._wasSuccessfulInitialized = true;
return this;
}
private void validatePrimitiveFieldsHaveBeenInitialized() {
List missingFields = null;
missingFields = addFieldIfMissing(missingFields, _wasSuccessfulInitialized, "wasSuccessful");
if (missingFields != null) {
throw new SafeIllegalArgumentException(
"Some required fields have not been set", SafeArg.of("missingFields", missingFields));
}
}
private static List addFieldIfMissing(List prev, boolean initialized, String fieldName) {
List missingFields = prev;
if (!initialized) {
if (missingFields == null) {
missingFields = new ArrayList<>(1);
}
missingFields.add(fieldName);
}
return missingFields;
}
@CheckReturnValue
public ConjureWaitForLocksResponse build() {
checkNotBuilt();
this._buildInvoked = true;
validatePrimitiveFieldsHaveBeenInitialized();
return new ConjureWaitForLocksResponse(wasSuccessful);
}
private void checkNotBuilt() {
Preconditions.checkState(!_buildInvoked, "Build has already been called");
}
}
}