1 package org.kuali.common.util.wait;
2
3 import org.kuali.common.util.Assert;
4
5 public final class WaitResult {
6
7 private final long start;
8 private final long stop;
9 private final long elapsed;
10
11 public static class Builder {
12
13 private final long start;
14 private final long stop;
15 private final long elapsed;
16
17 public Builder(long start, long stop) {
18 this.start = start;
19 this.stop = stop;
20 this.elapsed = stop - start;
21 }
22
23 public WaitResult build() {
24 Assert.noNegatives(start, stop, elapsed);
25 Assert.isTrue(stop >= start, "stop is less than start");
26 return new WaitResult(this);
27 }
28
29 }
30
31 private WaitResult(Builder builder) {
32 this.start = builder.start;
33 this.stop = builder.stop;
34 this.elapsed = builder.elapsed;
35 }
36
37 public long getStart() {
38 return start;
39 }
40
41 public long getElapsed() {
42 return elapsed;
43 }
44
45 public long getStop() {
46 return stop;
47 }
48
49 }