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

com.spotify.missinglink.datamodel.DeclaredClassBuilder Maven / Gradle / Ivy

The newest version!
package com.spotify.missinglink.datamodel;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import io.norberg.automatter.AutoMatter;
import javax.annotation.Generated;

@Generated("io.norberg.automatter.processor.AutoMatterProcessor")
public final class DeclaredClassBuilder {
  private ClassTypeDescriptor className;

  private ImmutableSet parents;

  private ImmutableMap methods;

  private ImmutableSet fields;

  public DeclaredClassBuilder() {
  }

  private DeclaredClassBuilder(DeclaredClass v) {
    this.className = v.className();
    this.parents = v.parents();
    this.methods = v.methods();
    this.fields = v.fields();
  }

  private DeclaredClassBuilder(DeclaredClassBuilder v) {
    this.className = v.className;
    this.parents = v.parents;
    this.methods = v.methods;
    this.fields = v.fields;
  }

  public ClassTypeDescriptor className() {
    return className;
  }

  public DeclaredClassBuilder className(ClassTypeDescriptor className) {
    if (className == null) {
      throw new NullPointerException("className");
    }
    this.className = className;
    return this;
  }

  public ImmutableSet parents() {
    return parents;
  }

  public DeclaredClassBuilder parents(ImmutableSet parents) {
    if (parents == null) {
      throw new NullPointerException("parents");
    }
    this.parents = parents;
    return this;
  }

  public ImmutableMap methods() {
    return methods;
  }

  public DeclaredClassBuilder methods(ImmutableMap methods) {
    if (methods == null) {
      throw new NullPointerException("methods");
    }
    this.methods = methods;
    return this;
  }

  public ImmutableSet fields() {
    return fields;
  }

  public DeclaredClassBuilder fields(ImmutableSet fields) {
    if (fields == null) {
      throw new NullPointerException("fields");
    }
    this.fields = fields;
    return this;
  }

  public DeclaredClass build() {
    return new Value(className, parents, methods, fields);
  }

  public static DeclaredClassBuilder from(DeclaredClass v) {
    return new DeclaredClassBuilder(v);
  }

  public static DeclaredClassBuilder from(DeclaredClassBuilder v) {
    return new DeclaredClassBuilder(v);
  }

  private static final class Value implements DeclaredClass {
    private final ClassTypeDescriptor className;

    private final ImmutableSet parents;

    private final ImmutableMap methods;

    private final ImmutableSet fields;

    private Value(@AutoMatter.Field("className") ClassTypeDescriptor className, @AutoMatter.Field("parents") ImmutableSet parents, @AutoMatter.Field("methods") ImmutableMap methods, @AutoMatter.Field("fields") ImmutableSet fields) {
      if (className == null) {
        throw new NullPointerException("className");
      }
      if (parents == null) {
        throw new NullPointerException("parents");
      }
      if (methods == null) {
        throw new NullPointerException("methods");
      }
      if (fields == null) {
        throw new NullPointerException("fields");
      }
      this.className = className;
      this.parents = parents;
      this.methods = methods;
      this.fields = fields;
    }

    @AutoMatter.Field
    @Override
    public ClassTypeDescriptor className() {
      return className;
    }

    @AutoMatter.Field
    @Override
    public ImmutableSet parents() {
      return parents;
    }

    @AutoMatter.Field
    @Override
    public ImmutableMap methods() {
      return methods;
    }

    @AutoMatter.Field
    @Override
    public ImmutableSet fields() {
      return fields;
    }

    public DeclaredClassBuilder builder() {
      return new DeclaredClassBuilder(this);
    }

    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (!(o instanceof DeclaredClass)) {
        return false;
      }
      final DeclaredClass that = (DeclaredClass) o;
      if (className != null ? !className.equals(that.className()) : that.className() != null) {
        return false;
      }
      if (parents != null ? !parents.equals(that.parents()) : that.parents() != null) {
        return false;
      }
      if (methods != null ? !methods.equals(that.methods()) : that.methods() != null) {
        return false;
      }
      if (fields != null ? !fields.equals(that.fields()) : that.fields() != null) {
        return false;
      }
      return true;
    }

    @Override
    public int hashCode() {
      int result = 1;
      long temp;
      result = 31 * result + (className != null ? className.hashCode() : 0);
      result = 31 * result + (parents != null ? parents.hashCode() : 0);
      result = 31 * result + (methods != null ? methods.hashCode() : 0);
      result = 31 * result + (fields != null ? fields.hashCode() : 0);
      return result;
    }

    @Override
    public String toString() {
      return "DeclaredClass{" +
      "className=" + className +
      ", parents=" + parents +
      ", methods=" + methods +
      ", fields=" + fields +
      '}';
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy