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

org.flyte.jflyte.api.AutoValue_Token Maven / Gradle / Ivy

There is a newer version: 0.4.60
Show newest version
package org.flyte.jflyte.api;

import java.time.Instant;
import javax.annotation.Nullable;
import javax.annotation.processing.Generated;

@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_Token extends Token {

  private final String accessToken;

  private final String tokenType;

  @Nullable
  private final String refreshToken;

  private final Instant expiry;

  private AutoValue_Token(
      String accessToken,
      String tokenType,
      @Nullable String refreshToken,
      Instant expiry) {
    this.accessToken = accessToken;
    this.tokenType = tokenType;
    this.refreshToken = refreshToken;
    this.expiry = expiry;
  }

  @Override
  public String accessToken() {
    return accessToken;
  }

  @Override
  public String tokenType() {
    return tokenType;
  }

  @Nullable
  @Override
  public String refreshToken() {
    return refreshToken;
  }

  @Override
  public Instant expiry() {
    return expiry;
  }

  @Override
  public String toString() {
    return "Token{"
        + "accessToken=" + accessToken + ", "
        + "tokenType=" + tokenType + ", "
        + "refreshToken=" + refreshToken + ", "
        + "expiry=" + expiry
        + "}";
  }

  @Override
  public boolean equals(Object o) {
    if (o == this) {
      return true;
    }
    if (o instanceof Token) {
      Token that = (Token) o;
      return this.accessToken.equals(that.accessToken())
          && this.tokenType.equals(that.tokenType())
          && (this.refreshToken == null ? that.refreshToken() == null : this.refreshToken.equals(that.refreshToken()))
          && this.expiry.equals(that.expiry());
    }
    return false;
  }

  @Override
  public int hashCode() {
    int h$ = 1;
    h$ *= 1000003;
    h$ ^= accessToken.hashCode();
    h$ *= 1000003;
    h$ ^= tokenType.hashCode();
    h$ *= 1000003;
    h$ ^= (refreshToken == null) ? 0 : refreshToken.hashCode();
    h$ *= 1000003;
    h$ ^= expiry.hashCode();
    return h$;
  }

  @Override
  public Token.Builder toBuilder() {
    return new Builder(this);
  }

  static final class Builder extends Token.Builder {
    private String accessToken;
    private String tokenType;
    private String refreshToken;
    private Instant expiry;
    Builder() {
    }
    private Builder(Token source) {
      this.accessToken = source.accessToken();
      this.tokenType = source.tokenType();
      this.refreshToken = source.refreshToken();
      this.expiry = source.expiry();
    }
    @Override
    public Token.Builder accessToken(String accessToken) {
      if (accessToken == null) {
        throw new NullPointerException("Null accessToken");
      }
      this.accessToken = accessToken;
      return this;
    }
    @Override
    public Token.Builder tokenType(String tokenType) {
      if (tokenType == null) {
        throw new NullPointerException("Null tokenType");
      }
      this.tokenType = tokenType;
      return this;
    }
    @Override
    public Token.Builder refreshToken(String refreshToken) {
      this.refreshToken = refreshToken;
      return this;
    }
    @Override
    public Token.Builder expiry(Instant expiry) {
      if (expiry == null) {
        throw new NullPointerException("Null expiry");
      }
      this.expiry = expiry;
      return this;
    }
    @Override
    public Token build() {
      if (this.accessToken == null
          || this.tokenType == null
          || this.expiry == null) {
        StringBuilder missing = new StringBuilder();
        if (this.accessToken == null) {
          missing.append(" accessToken");
        }
        if (this.tokenType == null) {
          missing.append(" tokenType");
        }
        if (this.expiry == null) {
          missing.append(" expiry");
        }
        throw new IllegalStateException("Missing required properties:" + missing);
      }
      return new AutoValue_Token(
          this.accessToken,
          this.tokenType,
          this.refreshToken,
          this.expiry);
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy