001package org.kuali.common.devops.jenkins.scan; 002 003import static org.kuali.common.util.base.Precondition.checkMin; 004 005public final class Spike { 006 007 private final long timestamp; 008 private final int count; 009 010 private Spike(Builder builder) { 011 this.timestamp = builder.timestamp; 012 this.count = builder.count; 013 } 014 015 public static Builder builder() { 016 return new Builder(); 017 } 018 019 public static class Builder implements org.apache.commons.lang3.builder.Builder<Spike> { 020 021 private long timestamp; 022 private int count; 023 024 public Builder withTimestamp(long timestamp) { 025 this.timestamp = timestamp; 026 return this; 027 } 028 029 public Builder withCount(int count) { 030 this.count = count; 031 return this; 032 } 033 034 @Override 035 public Spike build() { 036 return validate(new Spike(this)); 037 } 038 039 private static Spike validate(Spike instance) { 040 checkMin(instance.count, 0, "count"); 041 return instance; 042 } 043 } 044 045 public long getTimestamp() { 046 return timestamp; 047 } 048 049 public int getCount() { 050 return count; 051 } 052 053}