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

dagger.hilt.processor.internal.AutoValue_ComponentDescriptor Maven / Gradle / Ivy

There is a newer version: 2.45-kim-rc1
Show newest version


package dagger.hilt.processor.internal;

import com.google.common.collect.ImmutableSet;
import com.squareup.javapoet.ClassName;
import java.util.Optional;
import javax.annotation.Generated;

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

  private final ClassName component;
  private final ImmutableSet scopes;
  private final Optional creator;
  private final Optional parent;

  private AutoValue_ComponentDescriptor(
      ClassName component,
      ImmutableSet scopes,
      Optional creator,
      Optional parent) {
    this.component = component;
    this.scopes = scopes;
    this.creator = creator;
    this.parent = parent;
  }

  @Override
  public ClassName component() {
    return component;
  }

  @Override
  public ImmutableSet scopes() {
    return scopes;
  }

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

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

  @Override
  public String toString() {
    return "ComponentDescriptor{"
         + "component=" + component + ", "
         + "scopes=" + scopes + ", "
         + "creator=" + creator + ", "
         + "parent=" + parent
        + "}";
  }

  static final class Builder implements ComponentDescriptor.Builder {
    private ClassName component;
    private ImmutableSet scopes;
    private Optional creator = Optional.empty();
    private Optional parent = Optional.empty();
    Builder() {
    }
    @Override
    public ComponentDescriptor.Builder component(ClassName component) {
      if (component == null) {
        throw new NullPointerException("Null component");
      }
      this.component = component;
      return this;
    }
    @Override
    public ComponentDescriptor.Builder scopes(ImmutableSet scopes) {
      if (scopes == null) {
        throw new NullPointerException("Null scopes");
      }
      this.scopes = scopes;
      return this;
    }
    @Override
    public ComponentDescriptor.Builder scopes(ClassName... scopes) {
      if (scopes == null) {
        throw new NullPointerException("Null scopes");
      }
      this.scopes = ImmutableSet.copyOf(scopes);
      return this;
    }
    @Override
    public ComponentDescriptor.Builder creator(ClassName creator) {
      if (creator == null) {
        throw new NullPointerException("Null creator");
      }
      this.creator = Optional.of(creator);
      return this;
    }
    @Override
    public ComponentDescriptor.Builder parent(ComponentDescriptor parent) {
      if (parent == null) {
        throw new NullPointerException("Null parent");
      }
      this.parent = Optional.of(parent);
      return this;
    }
    @Override
    public ComponentDescriptor build() {
      String missing = "";
      if (this.component == null) {
        missing += " component";
      }
      if (this.scopes == null) {
        missing += " scopes";
      }
      if (!missing.isEmpty()) {
        throw new IllegalStateException("Missing required properties:" + missing);
      }
      return new AutoValue_ComponentDescriptor(
          this.component,
          this.scopes,
          this.creator,
          this.parent);
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy