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

com.google.gerrit.server.edit.AutoValue_CommitModification Maven / Gradle / Ivy

The newest version!
package com.google.gerrit.server.edit;

import com.google.common.collect.ImmutableList;
import com.google.gerrit.server.edit.tree.TreeModification;
import java.util.Optional;
import javax.annotation.processing.Generated;
import org.eclipse.jgit.lib.PersonIdent;

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

  private final ImmutableList treeModifications;

  private final Optional newCommitMessage;

  private final Optional newAuthor;

  private final Optional newCommitter;

  private AutoValue_CommitModification(
      ImmutableList treeModifications,
      Optional newCommitMessage,
      Optional newAuthor,
      Optional newCommitter) {
    this.treeModifications = treeModifications;
    this.newCommitMessage = newCommitMessage;
    this.newAuthor = newAuthor;
    this.newCommitter = newCommitter;
  }

  @Override
  public ImmutableList treeModifications() {
    return treeModifications;
  }

  @Override
  public Optional newCommitMessage() {
    return newCommitMessage;
  }

  @Override
  public Optional newAuthor() {
    return newAuthor;
  }

  @Override
  public Optional newCommitter() {
    return newCommitter;
  }

  @Override
  public String toString() {
    return "CommitModification{"
        + "treeModifications=" + treeModifications + ", "
        + "newCommitMessage=" + newCommitMessage + ", "
        + "newAuthor=" + newAuthor + ", "
        + "newCommitter=" + newCommitter
        + "}";
  }

  @Override
  public boolean equals(Object o) {
    if (o == this) {
      return true;
    }
    if (o instanceof CommitModification) {
      CommitModification that = (CommitModification) o;
      return this.treeModifications.equals(that.treeModifications())
          && this.newCommitMessage.equals(that.newCommitMessage())
          && this.newAuthor.equals(that.newAuthor())
          && this.newCommitter.equals(that.newCommitter());
    }
    return false;
  }

  @Override
  public int hashCode() {
    int h$ = 1;
    h$ *= 1000003;
    h$ ^= treeModifications.hashCode();
    h$ *= 1000003;
    h$ ^= newCommitMessage.hashCode();
    h$ *= 1000003;
    h$ ^= newAuthor.hashCode();
    h$ *= 1000003;
    h$ ^= newCommitter.hashCode();
    return h$;
  }

  static final class Builder extends CommitModification.Builder {
    private ImmutableList.Builder treeModificationsBuilder$;
    private ImmutableList treeModifications;
    private Optional newCommitMessage = Optional.empty();
    private Optional newAuthor = Optional.empty();
    private Optional newCommitter = Optional.empty();
    Builder() {
    }
    @Override
    public CommitModification.Builder treeModifications(ImmutableList treeModifications) {
      if (treeModifications == null) {
        throw new NullPointerException("Null treeModifications");
      }
      if (treeModificationsBuilder$ != null) {
        throw new IllegalStateException("Cannot set treeModifications after calling treeModificationsBuilder()");
      }
      this.treeModifications = treeModifications;
      return this;
    }
    @Override
    ImmutableList.Builder treeModificationsBuilder() {
      if (treeModificationsBuilder$ == null) {
        if (treeModifications == null) {
          treeModificationsBuilder$ = ImmutableList.builder();
        } else {
          treeModificationsBuilder$ = ImmutableList.builder();
          treeModificationsBuilder$.addAll(treeModifications);
          treeModifications = null;
        }
      }
      return treeModificationsBuilder$;
    }
    @Override
    public CommitModification.Builder newCommitMessage(String newCommitMessage) {
      this.newCommitMessage = Optional.of(newCommitMessage);
      return this;
    }
    @Override
    public CommitModification.Builder newAuthor(PersonIdent newAuthor) {
      this.newAuthor = Optional.of(newAuthor);
      return this;
    }
    @Override
    public CommitModification.Builder newCommitter(PersonIdent newCommitter) {
      this.newCommitter = Optional.of(newCommitter);
      return this;
    }
    @Override
    public CommitModification build() {
      if (treeModificationsBuilder$ != null) {
        this.treeModifications = treeModificationsBuilder$.build();
      } else if (this.treeModifications == null) {
        this.treeModifications = ImmutableList.of();
      }
      return new AutoValue_CommitModification(
          this.treeModifications,
          this.newCommitMessage,
          this.newAuthor,
          this.newCommitter);
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy