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

com.spotify.google.cloud.pubsub.client.PushConfigBuilder 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 java.util.Optional;
import javax.annotation.Generated;

@Generated("io.norberg.automatter.processor.AutoMatterProcessor")
public final class PushConfigBuilder {
  private Optional pushEndpoint;

  public PushConfigBuilder() {
    this.pushEndpoint = Optional.empty();
  }

  private PushConfigBuilder(PushConfig v) {
    this.pushEndpoint = v.pushEndpoint();
  }

  private PushConfigBuilder(PushConfigBuilder v) {
    this.pushEndpoint = v.pushEndpoint;
  }

  public Optional pushEndpoint() {
    return pushEndpoint;
  }

  public PushConfigBuilder pushEndpoint(String pushEndpoint) {
    return pushEndpoint(Optional.ofNullable(pushEndpoint));
  }

  public PushConfigBuilder pushEndpoint(Optional pushEndpoint) {
    if (pushEndpoint == null) {
      throw new NullPointerException("pushEndpoint");
    }
    this.pushEndpoint = (Optional)pushEndpoint;
    return this;
  }

  public PushConfig build() {
    return new Value(pushEndpoint);
  }

  public static PushConfigBuilder from(PushConfig v) {
    return new PushConfigBuilder(v);
  }

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

  private static final class Value implements PushConfig {
    private final Optional pushEndpoint;

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

    @AutoMatter.Field
    @Override
    public Optional pushEndpoint() {
      return pushEndpoint;
    }

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

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

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

    @Override
    public String toString() {
      return "PushConfig{" +
      "pushEndpoint=" + pushEndpoint +
      '}';
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy