All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.spotify.google.cloud.pubsub.client.TopicBuilder Maven / Gradle / Ivy

There is a newer version: 1.34
Show newest version
package com.spotify.google.cloud.pubsub.client;

import io.norberg.automatter.AutoMatter;
import javax.annotation.Generated;

@Generated("io.norberg.automatter.processor.AutoMatterProcessor")
public final class TopicBuilder {
  private String name;

  public TopicBuilder() {
  }

  private TopicBuilder(Topic v) {
    this.name = v.name();
  }

  private TopicBuilder(TopicBuilder v) {
    this.name = v.name;
  }

  public String name() {
    return name;
  }

  public TopicBuilder name(String name) {
    if (name == null) {
      throw new NullPointerException("name");
    }
    this.name = name;
    return this;
  }

  public Topic build() {
    return new Value(name);
  }

  public static TopicBuilder from(Topic v) {
    return new TopicBuilder(v);
  }

  public static TopicBuilder from(TopicBuilder v) {
    return new TopicBuilder(v);
  }

  private static final class Value implements Topic {
    private final String name;

    private Value(@AutoMatter.Field("name") String name) {
      if (name == null) {
        throw new NullPointerException("name");
      }
      this.name = name;
    }

    @AutoMatter.Field
    @Override
    public String name() {
      return name;
    }

    public TopicBuilder builder() {
      return new TopicBuilder(this);
    }

    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (!(o instanceof Topic)) {
        return false;
      }
      final Topic that = (Topic) o;
      if (name != null ? !name.equals(that.name()) : that.name() != null) {
        return false;
      }
      return true;
    }

    @Override
    public int hashCode() {
      int result = 1;
      long temp;
      result = 31 * result + (name != null ? name.hashCode() : 0);
      return result;
    }

    @Override
    public String toString() {
      return "Topic{" +
      "name=" + name +
      '}';
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy