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

com.google.gerrit.entities.AutoValue_Permission Maven / Gradle / Ivy

There is a newer version: 3.10.1
Show newest version
package com.google.gerrit.entities;

import com.google.common.collect.ImmutableList;
import javax.annotation.processing.Generated;

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

  private final String name;

  private final boolean exclusiveGroup;

  private final ImmutableList rules;

  private AutoValue_Permission(
      String name,
      boolean exclusiveGroup,
      ImmutableList rules) {
    this.name = name;
    this.exclusiveGroup = exclusiveGroup;
    this.rules = rules;
  }

  @Override
  public String getName() {
    return name;
  }

  @Override
  protected boolean isExclusiveGroup() {
    return exclusiveGroup;
  }

  @Override
  public ImmutableList getRules() {
    return rules;
  }

  @Override
  public boolean equals(Object o) {
    if (o == this) {
      return true;
    }
    if (o instanceof Permission) {
      Permission that = (Permission) o;
      return this.name.equals(that.getName())
          && this.exclusiveGroup == that.isExclusiveGroup()
          && this.rules.equals(that.getRules());
    }
    return false;
  }

  @Override
  public int hashCode() {
    int h$ = 1;
    h$ *= 1000003;
    h$ ^= name.hashCode();
    h$ *= 1000003;
    h$ ^= exclusiveGroup ? 1231 : 1237;
    h$ *= 1000003;
    h$ ^= rules.hashCode();
    return h$;
  }

  @Override
  protected Permission.Builder autoToBuilder() {
    return new Builder(this);
  }

  static final class Builder extends Permission.Builder {
    private String name;
    private Boolean exclusiveGroup;
    private ImmutableList rules;
    Builder() {
    }
    private Builder(Permission source) {
      this.name = source.getName();
      this.exclusiveGroup = source.isExclusiveGroup();
      this.rules = source.getRules();
    }
    @Override
    public Permission.Builder setName(String name) {
      if (name == null) {
        throw new NullPointerException("Null name");
      }
      this.name = name;
      return this;
    }
    @Override
    public String getName() {
      if (name == null) {
        throw new IllegalStateException("Property \"name\" has not been set");
      }
      return name;
    }
    @Override
    public Permission.Builder setExclusiveGroup(boolean exclusiveGroup) {
      this.exclusiveGroup = exclusiveGroup;
      return this;
    }
    @Override
    protected Permission.Builder setRules(ImmutableList rules) {
      if (rules == null) {
        throw new NullPointerException("Null rules");
      }
      this.rules = rules;
      return this;
    }
    @Override
    protected ImmutableList getRules() {
      if (rules == null) {
        throw new IllegalStateException("Property \"rules\" has not been set");
      }
      return rules;
    }
    @Override
    protected Permission autoBuild() {
      String missing = "";
      if (this.name == null) {
        missing += " name";
      }
      if (this.exclusiveGroup == null) {
        missing += " exclusiveGroup";
      }
      if (this.rules == null) {
        missing += " rules";
      }
      if (!missing.isEmpty()) {
        throw new IllegalStateException("Missing required properties:" + missing);
      }
      return new AutoValue_Permission(
          this.name,
          this.exclusiveGroup,
          this.rules);
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy