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

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

The newest version!
package dagger.hilt.processor.internal;

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

// Generated by 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) {
      this.scopes = ImmutableSet.copyOf(scopes);
      return this;
    }
    @Override
    public ComponentDescriptor.Builder creator(ClassName creator) {
      this.creator = Optional.of(creator);
      return this;
    }
    @Override
    public ComponentDescriptor.Builder parent(ComponentDescriptor parent) {
      this.parent = Optional.of(parent);
      return this;
    }
    @Override
    public ComponentDescriptor build() {
      if (this.component == null
          || this.scopes == null) {
        StringBuilder missing = new StringBuilder();
        if (this.component == null) {
          missing.append(" component");
        }
        if (this.scopes == null) {
          missing.append(" scopes");
        }
        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