-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObserveOptions.java
More file actions
42 lines (35 loc) · 1.06 KB
/
ObserveOptions.java
File metadata and controls
42 lines (35 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package dev.axme.sdk;
/**
* Options for {@link AxmeClient#observe} and {@link AxmeClient#waitFor} polling methods.
*/
public final class ObserveOptions {
private final int since;
private final double pollIntervalSeconds;
private final Double timeoutSeconds;
public ObserveOptions() {
this(0, 1.0, null);
}
public ObserveOptions(int since, double pollIntervalSeconds, Double timeoutSeconds) {
if (pollIntervalSeconds <= 0) {
throw new IllegalArgumentException("pollIntervalSeconds must be positive");
}
if (timeoutSeconds != null && timeoutSeconds <= 0) {
throw new IllegalArgumentException("timeoutSeconds must be positive");
}
this.since = since;
this.pollIntervalSeconds = pollIntervalSeconds;
this.timeoutSeconds = timeoutSeconds;
}
public int getSince() {
return since;
}
public double getPollIntervalSeconds() {
return pollIntervalSeconds;
}
public Double getTimeoutSeconds() {
return timeoutSeconds;
}
public static ObserveOptions defaults() {
return new ObserveOptions();
}
}