
com.spotify.autoscaler.metric.ClusterDataBuilder Maven / Gradle / Ivy
package com.spotify.autoscaler.metric;
import com.spotify.autoscaler.db.BigtableCluster;
import com.spotify.autoscaler.db.ErrorCode;
import io.norberg.automatter.AutoMatter;
import java.util.Optional;
import javax.annotation.processing.Generated;
@Generated("io.norberg.automatter.processor.AutoMatterProcessor")
public final class ClusterDataBuilder {
private BigtableCluster cluster;
private int currentNodeCount;
private int minNodeCount;
private int maxNodeCount;
private int effectiveMinNodeCount;
private double cpuUtil;
private int consecutiveFailureCount;
private double storageUtil;
private Optional lastErrorCode;
public ClusterDataBuilder() {
this.lastErrorCode = Optional.empty();
}
private ClusterDataBuilder(ClusterData v) {
this.cluster = v.cluster();
this.currentNodeCount = v.currentNodeCount();
this.minNodeCount = v.minNodeCount();
this.maxNodeCount = v.maxNodeCount();
this.effectiveMinNodeCount = v.effectiveMinNodeCount();
this.cpuUtil = v.cpuUtil();
this.consecutiveFailureCount = v.consecutiveFailureCount();
this.storageUtil = v.storageUtil();
this.lastErrorCode = v.lastErrorCode();
}
private ClusterDataBuilder(ClusterDataBuilder v) {
this.cluster = v.cluster;
this.currentNodeCount = v.currentNodeCount;
this.minNodeCount = v.minNodeCount;
this.maxNodeCount = v.maxNodeCount;
this.effectiveMinNodeCount = v.effectiveMinNodeCount;
this.cpuUtil = v.cpuUtil;
this.consecutiveFailureCount = v.consecutiveFailureCount;
this.storageUtil = v.storageUtil;
this.lastErrorCode = v.lastErrorCode;
}
public BigtableCluster cluster() {
return cluster;
}
public ClusterDataBuilder cluster(BigtableCluster cluster) {
if (cluster == null) {
throw new NullPointerException("cluster");
}
this.cluster = cluster;
return this;
}
public int currentNodeCount() {
return currentNodeCount;
}
public ClusterDataBuilder currentNodeCount(int currentNodeCount) {
this.currentNodeCount = currentNodeCount;
return this;
}
public int minNodeCount() {
return minNodeCount;
}
public ClusterDataBuilder minNodeCount(int minNodeCount) {
this.minNodeCount = minNodeCount;
return this;
}
public int maxNodeCount() {
return maxNodeCount;
}
public ClusterDataBuilder maxNodeCount(int maxNodeCount) {
this.maxNodeCount = maxNodeCount;
return this;
}
public int effectiveMinNodeCount() {
return effectiveMinNodeCount;
}
public ClusterDataBuilder effectiveMinNodeCount(int effectiveMinNodeCount) {
this.effectiveMinNodeCount = effectiveMinNodeCount;
return this;
}
public double cpuUtil() {
return cpuUtil;
}
public ClusterDataBuilder cpuUtil(double cpuUtil) {
this.cpuUtil = cpuUtil;
return this;
}
public int consecutiveFailureCount() {
return consecutiveFailureCount;
}
public ClusterDataBuilder consecutiveFailureCount(int consecutiveFailureCount) {
this.consecutiveFailureCount = consecutiveFailureCount;
return this;
}
public double storageUtil() {
return storageUtil;
}
public ClusterDataBuilder storageUtil(double storageUtil) {
this.storageUtil = storageUtil;
return this;
}
public Optional lastErrorCode() {
return lastErrorCode;
}
public ClusterDataBuilder lastErrorCode(ErrorCode lastErrorCode) {
return lastErrorCode(Optional.ofNullable(lastErrorCode));
}
@SuppressWarnings("unchecked")
public ClusterDataBuilder lastErrorCode(Optional extends ErrorCode> lastErrorCode) {
if (lastErrorCode == null) {
throw new NullPointerException("lastErrorCode");
}
this.lastErrorCode = (Optional)lastErrorCode;
return this;
}
public ClusterData build() {
return new Value(cluster, currentNodeCount, minNodeCount, maxNodeCount, effectiveMinNodeCount, cpuUtil, consecutiveFailureCount, storageUtil, lastErrorCode);
}
public static ClusterDataBuilder from(ClusterData v) {
return new ClusterDataBuilder(v);
}
public static ClusterDataBuilder from(ClusterDataBuilder v) {
return new ClusterDataBuilder(v);
}
private static final class Value implements ClusterData {
private final BigtableCluster cluster;
private final int currentNodeCount;
private final int minNodeCount;
private final int maxNodeCount;
private final int effectiveMinNodeCount;
private final double cpuUtil;
private final int consecutiveFailureCount;
private final double storageUtil;
private final Optional lastErrorCode;
private Value(@AutoMatter.Field("cluster") BigtableCluster cluster,
@AutoMatter.Field("currentNodeCount") int currentNodeCount,
@AutoMatter.Field("minNodeCount") int minNodeCount,
@AutoMatter.Field("maxNodeCount") int maxNodeCount,
@AutoMatter.Field("effectiveMinNodeCount") int effectiveMinNodeCount,
@AutoMatter.Field("cpuUtil") double cpuUtil,
@AutoMatter.Field("consecutiveFailureCount") int consecutiveFailureCount,
@AutoMatter.Field("storageUtil") double storageUtil,
@AutoMatter.Field("lastErrorCode") Optional lastErrorCode) {
if (cluster == null) {
throw new NullPointerException("cluster");
}
if (lastErrorCode == null) {
throw new NullPointerException("lastErrorCode");
}
this.cluster = cluster;
this.currentNodeCount = currentNodeCount;
this.minNodeCount = minNodeCount;
this.maxNodeCount = maxNodeCount;
this.effectiveMinNodeCount = effectiveMinNodeCount;
this.cpuUtil = cpuUtil;
this.consecutiveFailureCount = consecutiveFailureCount;
this.storageUtil = storageUtil;
this.lastErrorCode = lastErrorCode;
}
@AutoMatter.Field
@Override
public BigtableCluster cluster() {
return cluster;
}
@AutoMatter.Field
@Override
public int currentNodeCount() {
return currentNodeCount;
}
@AutoMatter.Field
@Override
public int minNodeCount() {
return minNodeCount;
}
@AutoMatter.Field
@Override
public int maxNodeCount() {
return maxNodeCount;
}
@AutoMatter.Field
@Override
public int effectiveMinNodeCount() {
return effectiveMinNodeCount;
}
@AutoMatter.Field
@Override
public double cpuUtil() {
return cpuUtil;
}
@AutoMatter.Field
@Override
public int consecutiveFailureCount() {
return consecutiveFailureCount;
}
@AutoMatter.Field
@Override
public double storageUtil() {
return storageUtil;
}
@AutoMatter.Field
@Override
public Optional lastErrorCode() {
return lastErrorCode;
}
public ClusterDataBuilder builder() {
return new ClusterDataBuilder(this);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ClusterData)) {
return false;
}
final ClusterData that = (ClusterData) o;
if (cluster != null ? !cluster.equals(that.cluster()) : that.cluster() != null) {
return false;
}
if (currentNodeCount != that.currentNodeCount()) {
return false;
}
if (minNodeCount != that.minNodeCount()) {
return false;
}
if (maxNodeCount != that.maxNodeCount()) {
return false;
}
if (effectiveMinNodeCount != that.effectiveMinNodeCount()) {
return false;
}
if (Double.compare(cpuUtil, that.cpuUtil()) != 0) {
return false;
}
if (consecutiveFailureCount != that.consecutiveFailureCount()) {
return false;
}
if (Double.compare(storageUtil, that.storageUtil()) != 0) {
return false;
}
if (lastErrorCode != null ? !lastErrorCode.equals(that.lastErrorCode()) : that.lastErrorCode() != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = 1;
long temp;
result = 31 * result + (this.cluster != null ? this.cluster.hashCode() : 0);
result = 31 * result + this.currentNodeCount;
result = 31 * result + this.minNodeCount;
result = 31 * result + this.maxNodeCount;
result = 31 * result + this.effectiveMinNodeCount;
temp = Double.doubleToLongBits(this.cpuUtil);
result = 31 * result + (int) (temp ^ (temp >>> 32));
result = 31 * result + this.consecutiveFailureCount;
temp = Double.doubleToLongBits(this.storageUtil);
result = 31 * result + (int) (temp ^ (temp >>> 32));
result = 31 * result + (this.lastErrorCode != null ? this.lastErrorCode.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "ClusterData{" +
"cluster=" + cluster +
", currentNodeCount=" + currentNodeCount +
", minNodeCount=" + minNodeCount +
", maxNodeCount=" + maxNodeCount +
", effectiveMinNodeCount=" + effectiveMinNodeCount +
", cpuUtil=" + cpuUtil +
", consecutiveFailureCount=" + consecutiveFailureCount +
", storageUtil=" + storageUtil +
", lastErrorCode=" + lastErrorCode +
'}';
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy