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

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

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

import io.norberg.automatter.AutoMatter;
import javax.annotation.Generated;

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

  private MethodDescriptor fromMethod;

  private int fromLineNumber;

  private ClassTypeDescriptor targetClass;

  private MethodDescriptor targetMethod;

  public MethodDependencyBuilder() {
  }

  private MethodDependencyBuilder(MethodDependency v) {
    this.fromClass = v.fromClass();
    this.fromMethod = v.fromMethod();
    this.fromLineNumber = v.fromLineNumber();
    this.targetClass = v.targetClass();
    this.targetMethod = v.targetMethod();
  }

  private MethodDependencyBuilder(MethodDependencyBuilder v) {
    this.fromClass = v.fromClass;
    this.fromMethod = v.fromMethod;
    this.fromLineNumber = v.fromLineNumber;
    this.targetClass = v.targetClass;
    this.targetMethod = v.targetMethod;
  }

  public ClassTypeDescriptor fromClass() {
    return fromClass;
  }

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

  public MethodDescriptor fromMethod() {
    return fromMethod;
  }

  public MethodDependencyBuilder fromMethod(MethodDescriptor fromMethod) {
    if (fromMethod == null) {
      throw new NullPointerException("fromMethod");
    }
    this.fromMethod = fromMethod;
    return this;
  }

  public int fromLineNumber() {
    return fromLineNumber;
  }

  public MethodDependencyBuilder fromLineNumber(int fromLineNumber) {
    this.fromLineNumber = fromLineNumber;
    return this;
  }

  public ClassTypeDescriptor targetClass() {
    return targetClass;
  }

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

  public MethodDescriptor targetMethod() {
    return targetMethod;
  }

  public MethodDependencyBuilder targetMethod(MethodDescriptor targetMethod) {
    if (targetMethod == null) {
      throw new NullPointerException("targetMethod");
    }
    this.targetMethod = targetMethod;
    return this;
  }

  public MethodDependency build() {
    return new Value(fromClass, fromMethod, fromLineNumber, targetClass, targetMethod);
  }

  public static MethodDependencyBuilder from(MethodDependency v) {
    return new MethodDependencyBuilder(v);
  }

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

  private static final class Value implements MethodDependency {
    private final ClassTypeDescriptor fromClass;

    private final MethodDescriptor fromMethod;

    private final int fromLineNumber;

    private final ClassTypeDescriptor targetClass;

    private final MethodDescriptor targetMethod;

    private Value(@AutoMatter.Field("fromClass") ClassTypeDescriptor fromClass, @AutoMatter.Field("fromMethod") MethodDescriptor fromMethod, @AutoMatter.Field("fromLineNumber") int fromLineNumber, @AutoMatter.Field("targetClass") ClassTypeDescriptor targetClass, @AutoMatter.Field("targetMethod") MethodDescriptor targetMethod) {
      if (fromClass == null) {
        throw new NullPointerException("fromClass");
      }
      if (fromMethod == null) {
        throw new NullPointerException("fromMethod");
      }
      if (targetClass == null) {
        throw new NullPointerException("targetClass");
      }
      if (targetMethod == null) {
        throw new NullPointerException("targetMethod");
      }
      this.fromClass = fromClass;
      this.fromMethod = fromMethod;
      this.fromLineNumber = fromLineNumber;
      this.targetClass = targetClass;
      this.targetMethod = targetMethod;
    }

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

    @AutoMatter.Field
    @Override
    public MethodDescriptor fromMethod() {
      return fromMethod;
    }

    @AutoMatter.Field
    @Override
    public int fromLineNumber() {
      return fromLineNumber;
    }

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

    @AutoMatter.Field
    @Override
    public MethodDescriptor targetMethod() {
      return targetMethod;
    }

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

    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (!(o instanceof MethodDependency)) {
        return false;
      }
      final MethodDependency that = (MethodDependency) o;
      if (fromClass != null ? !fromClass.equals(that.fromClass()) : that.fromClass() != null) {
        return false;
      }
      if (fromMethod != null ? !fromMethod.equals(that.fromMethod()) : that.fromMethod() != null) {
        return false;
      }
      if (fromLineNumber != that.fromLineNumber()) {
        return false;
      }
      if (targetClass != null ? !targetClass.equals(that.targetClass()) : that.targetClass() != null) {
        return false;
      }
      if (targetMethod != null ? !targetMethod.equals(that.targetMethod()) : that.targetMethod() != null) {
        return false;
      }
      return true;
    }

    @Override
    public int hashCode() {
      int result = 1;
      long temp;
      result = 31 * result + (fromClass != null ? fromClass.hashCode() : 0);
      result = 31 * result + (fromMethod != null ? fromMethod.hashCode() : 0);
      result = 31 * result + fromLineNumber;
      result = 31 * result + (targetClass != null ? targetClass.hashCode() : 0);
      result = 31 * result + (targetMethod != null ? targetMethod.hashCode() : 0);
      return result;
    }

    @Override
    public String toString() {
      return "MethodDependency{" +
      "fromClass=" + fromClass +
      ", fromMethod=" + fromMethod +
      ", fromLineNumber=" + fromLineNumber +
      ", targetClass=" + targetClass +
      ", targetMethod=" + targetMethod +
      '}';
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy