com.spotify.google.cloud.pubsub.client.PublishResponseBuilder Maven / Gradle / Ivy
package com.spotify.google.cloud.pubsub.client;
import io.norberg.automatter.AutoMatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import javax.annotation.Generated;
@Generated("io.norberg.automatter.processor.AutoMatterProcessor")
final class PublishResponseBuilder {
private List messageIds;
public PublishResponseBuilder() {
}
private PublishResponseBuilder(PublishResponse v) {
List extends String> _messageIds = v.messageIds();
this.messageIds = (_messageIds == null) ? null : new ArrayList(_messageIds);
}
private PublishResponseBuilder(PublishResponseBuilder v) {
this.messageIds = (v.messageIds == null) ? null : new ArrayList(v.messageIds);
}
public List messageIds() {
if (this.messageIds == null) {
this.messageIds = new ArrayList();
}
return messageIds;
}
public PublishResponseBuilder messageIds(List extends String> messageIds) {
return messageIds((Collection extends String>) messageIds);
}
public PublishResponseBuilder messageIds(Collection extends String> messageIds) {
if (messageIds == null) {
throw new NullPointerException("messageIds");
}
for (String item : messageIds) {
if (item == null) {
throw new NullPointerException("messageIds: null item");
}
}
this.messageIds = new ArrayList(messageIds);
return this;
}
public PublishResponseBuilder messageIds(Iterable extends String> messageIds) {
if (messageIds == null) {
throw new NullPointerException("messageIds");
}
if (messageIds instanceof Collection) {
return messageIds((Collection extends String>) messageIds);
}
return messageIds(messageIds.iterator());
}
public PublishResponseBuilder messageIds(Iterator extends String> messageIds) {
if (messageIds == null) {
throw new NullPointerException("messageIds");
}
this.messageIds = new ArrayList();
while (messageIds.hasNext()) {
String item = messageIds.next();
if (item == null) {
throw new NullPointerException("messageIds: null item");
}
this.messageIds.add(item);
}
return this;
}
public PublishResponseBuilder messageIds(String... messageIds) {
if (messageIds == null) {
throw new NullPointerException("messageIds");
}
return messageIds(Arrays.asList(messageIds));
}
public PublishResponseBuilder addMessageId(String messageId) {
if (messageId == null) {
throw new NullPointerException("messageId");
}
if (this.messageIds == null) {
this.messageIds = new ArrayList();
}
messageIds.add(messageId);
return this;
}
public PublishResponse build() {
List _messageIds = (messageIds != null) ? Collections.unmodifiableList(new ArrayList(messageIds)) : Collections.emptyList();
return new Value(_messageIds);
}
public static PublishResponseBuilder from(PublishResponse v) {
return new PublishResponseBuilder(v);
}
public static PublishResponseBuilder from(PublishResponseBuilder v) {
return new PublishResponseBuilder(v);
}
private static final class Value implements PublishResponse {
private final List messageIds;
private Value(@AutoMatter.Field("messageIds") List messageIds) {
this.messageIds = (messageIds != null) ? messageIds : Collections.emptyList();
}
@AutoMatter.Field
@Override
public List messageIds() {
return messageIds;
}
public PublishResponseBuilder builder() {
return new PublishResponseBuilder(this);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof PublishResponse)) {
return false;
}
final PublishResponse that = (PublishResponse) o;
if (messageIds != null ? !messageIds.equals(that.messageIds()) : that.messageIds() != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = 1;
long temp;
result = 31 * result + (messageIds != null ? messageIds.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "PublishResponse{" +
"messageIds=" + messageIds +
'}';
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy