com.spotify.missinglink.datamodel.MethodDescriptorBuilder Maven / Gradle / Ivy
The newest version!
package com.spotify.missinglink.datamodel;
import com.google.common.collect.ImmutableList;
import io.norberg.automatter.AutoMatter;
import javax.annotation.Generated;
@Generated("io.norberg.automatter.processor.AutoMatterProcessor")
public final class MethodDescriptorBuilder {
private TypeDescriptor returnType;
private String name;
private ImmutableList parameterTypes;
public MethodDescriptorBuilder() {
}
private MethodDescriptorBuilder(MethodDescriptor v) {
this.returnType = v.returnType();
this.name = v.name();
this.parameterTypes = v.parameterTypes();
}
private MethodDescriptorBuilder(MethodDescriptorBuilder v) {
this.returnType = v.returnType;
this.name = v.name;
this.parameterTypes = v.parameterTypes;
}
public TypeDescriptor returnType() {
return returnType;
}
public MethodDescriptorBuilder returnType(TypeDescriptor returnType) {
if (returnType == null) {
throw new NullPointerException("returnType");
}
this.returnType = returnType;
return this;
}
public String name() {
return name;
}
public MethodDescriptorBuilder name(String name) {
if (name == null) {
throw new NullPointerException("name");
}
this.name = name;
return this;
}
public ImmutableList parameterTypes() {
return parameterTypes;
}
public MethodDescriptorBuilder parameterTypes(ImmutableList parameterTypes) {
if (parameterTypes == null) {
throw new NullPointerException("parameterTypes");
}
this.parameterTypes = parameterTypes;
return this;
}
public MethodDescriptor build() {
return new Value(returnType, name, parameterTypes);
}
public static MethodDescriptorBuilder from(MethodDescriptor v) {
return new MethodDescriptorBuilder(v);
}
public static MethodDescriptorBuilder from(MethodDescriptorBuilder v) {
return new MethodDescriptorBuilder(v);
}
private static final class Value implements MethodDescriptor {
private final TypeDescriptor returnType;
private final String name;
private final ImmutableList parameterTypes;
private Value(@AutoMatter.Field("returnType") TypeDescriptor returnType, @AutoMatter.Field("name") String name, @AutoMatter.Field("parameterTypes") ImmutableList parameterTypes) {
if (returnType == null) {
throw new NullPointerException("returnType");
}
if (name == null) {
throw new NullPointerException("name");
}
if (parameterTypes == null) {
throw new NullPointerException("parameterTypes");
}
this.returnType = returnType;
this.name = name;
this.parameterTypes = parameterTypes;
}
@AutoMatter.Field
@Override
public TypeDescriptor returnType() {
return returnType;
}
@AutoMatter.Field
@Override
public String name() {
return name;
}
@AutoMatter.Field
@Override
public ImmutableList parameterTypes() {
return parameterTypes;
}
public MethodDescriptorBuilder builder() {
return new MethodDescriptorBuilder(this);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof MethodDescriptor)) {
return false;
}
final MethodDescriptor that = (MethodDescriptor) o;
if (returnType != null ? !returnType.equals(that.returnType()) : that.returnType() != null) {
return false;
}
if (name != null ? !name.equals(that.name()) : that.name() != null) {
return false;
}
if (parameterTypes != null ? !parameterTypes.equals(that.parameterTypes()) : that.parameterTypes() != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = 1;
long temp;
result = 31 * result + (returnType != null ? returnType.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (parameterTypes != null ? parameterTypes.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "MethodDescriptor{" +
"returnType=" + returnType +
", name=" + name +
", parameterTypes=" + parameterTypes +
'}';
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy