1 package org.kuali.common.devops.jenkins.archive.model; 2 3 import org.kuali.common.core.base.TimedInterval; 4 import org.kuali.common.core.build.ValidatingBuilder; 5 import org.kuali.common.core.validate.annotation.IdiotProofImmutable; 6 7 import com.google.common.base.Stopwatch; 8 9 @IdiotProofImmutable 10 public final class ArchiveBuildsResult { 11 12 private final JenkinsMaster master; 13 private final TimedInterval timing; 14 15 private ArchiveBuildsResult(Builder builder) { 16 this.master = builder.master; 17 this.timing = builder.timing; 18 } 19 20 public static Builder builder() { 21 return new Builder(); 22 } 23 24 public static class Builder extends ValidatingBuilder<ArchiveBuildsResult> { 25 26 private JenkinsMaster master; 27 private TimedInterval timing; 28 29 public Builder withMaster(JenkinsMaster master) { 30 this.master = master; 31 return this; 32 } 33 34 public Builder withTiming(TimedInterval timing) { 35 this.timing = timing; 36 return this; 37 } 38 39 public Builder time(Stopwatch sw) { 40 return withTiming(TimedInterval.build(sw)); 41 } 42 43 @Override 44 public ArchiveBuildsResult build() { 45 return validate(new ArchiveBuildsResult(this)); 46 } 47 } 48 49 public TimedInterval getTiming() { 50 return timing; 51 } 52 53 public JenkinsMaster getMaster() { 54 return master; 55 } 56 57 }