com.spotify.google.cloud.pubsub.client.SubscriptionBuilder Maven / Gradle / Ivy
package com.spotify.google.cloud.pubsub.client;
import io.norberg.automatter.AutoMatter;
import java.util.Optional;
import javax.annotation.Generated;
@Generated("io.norberg.automatter.processor.AutoMatterProcessor")
public final class SubscriptionBuilder {
private String name;
private String topic;
private Optional pushConfig;
private Optional ackDeadlineSeconds;
public SubscriptionBuilder() {
this.pushConfig = Optional.empty();
this.ackDeadlineSeconds = Optional.empty();
}
private SubscriptionBuilder(Subscription v) {
this.name = v.name();
this.topic = v.topic();
this.pushConfig = v.pushConfig();
this.ackDeadlineSeconds = v.ackDeadlineSeconds();
}
private SubscriptionBuilder(SubscriptionBuilder v) {
this.name = v.name;
this.topic = v.topic;
this.pushConfig = v.pushConfig;
this.ackDeadlineSeconds = v.ackDeadlineSeconds;
}
public String name() {
return name;
}
public SubscriptionBuilder name(String name) {
if (name == null) {
throw new NullPointerException("name");
}
this.name = name;
return this;
}
public String topic() {
return topic;
}
public SubscriptionBuilder topic(String topic) {
if (topic == null) {
throw new NullPointerException("topic");
}
this.topic = topic;
return this;
}
public Optional pushConfig() {
return pushConfig;
}
public SubscriptionBuilder pushConfig(PushConfig pushConfig) {
return pushConfig(Optional.ofNullable(pushConfig));
}
public SubscriptionBuilder pushConfig(Optional extends PushConfig> pushConfig) {
if (pushConfig == null) {
throw new NullPointerException("pushConfig");
}
this.pushConfig = (Optional)pushConfig;
return this;
}
public Optional ackDeadlineSeconds() {
return ackDeadlineSeconds;
}
public SubscriptionBuilder ackDeadlineSeconds(Integer ackDeadlineSeconds) {
return ackDeadlineSeconds(Optional.ofNullable(ackDeadlineSeconds));
}
public SubscriptionBuilder ackDeadlineSeconds(Optional extends Integer> ackDeadlineSeconds) {
if (ackDeadlineSeconds == null) {
throw new NullPointerException("ackDeadlineSeconds");
}
this.ackDeadlineSeconds = (Optional)ackDeadlineSeconds;
return this;
}
public Subscription build() {
return new Value(name, topic, pushConfig, ackDeadlineSeconds);
}
public static SubscriptionBuilder from(Subscription v) {
return new SubscriptionBuilder(v);
}
public static SubscriptionBuilder from(SubscriptionBuilder v) {
return new SubscriptionBuilder(v);
}
private static final class Value implements Subscription {
private final String name;
private final String topic;
private final Optional pushConfig;
private final Optional ackDeadlineSeconds;
private Value(@AutoMatter.Field("name") String name, @AutoMatter.Field("topic") String topic, @AutoMatter.Field("pushConfig") Optional pushConfig, @AutoMatter.Field("ackDeadlineSeconds") Optional ackDeadlineSeconds) {
if (name == null) {
throw new NullPointerException("name");
}
if (topic == null) {
throw new NullPointerException("topic");
}
if (pushConfig == null) {
throw new NullPointerException("pushConfig");
}
if (ackDeadlineSeconds == null) {
throw new NullPointerException("ackDeadlineSeconds");
}
this.name = name;
this.topic = topic;
this.pushConfig = pushConfig;
this.ackDeadlineSeconds = ackDeadlineSeconds;
}
@AutoMatter.Field
@Override
public String name() {
return name;
}
@AutoMatter.Field
@Override
public String topic() {
return topic;
}
@AutoMatter.Field
@Override
public Optional pushConfig() {
return pushConfig;
}
@AutoMatter.Field
@Override
public Optional ackDeadlineSeconds() {
return ackDeadlineSeconds;
}
public SubscriptionBuilder builder() {
return new SubscriptionBuilder(this);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Subscription)) {
return false;
}
final Subscription that = (Subscription) o;
if (name != null ? !name.equals(that.name()) : that.name() != null) {
return false;
}
if (topic != null ? !topic.equals(that.topic()) : that.topic() != null) {
return false;
}
if (pushConfig != null ? !pushConfig.equals(that.pushConfig()) : that.pushConfig() != null) {
return false;
}
if (ackDeadlineSeconds != null ? !ackDeadlineSeconds.equals(that.ackDeadlineSeconds()) : that.ackDeadlineSeconds() != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = 1;
long temp;
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (topic != null ? topic.hashCode() : 0);
result = 31 * result + (pushConfig != null ? pushConfig.hashCode() : 0);
result = 31 * result + (ackDeadlineSeconds != null ? ackDeadlineSeconds.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "Subscription{" +
"name=" + name +
", topic=" + topic +
", pushConfig=" + pushConfig +
", ackDeadlineSeconds=" + ackDeadlineSeconds +
'}';
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy