• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

temporalio / sdk-java / #174

pending completion
#174

push

github-actions

web-flow
Add schedules API (#1776)

Add schedules API

1143 of 1143 new or added lines in 35 files covered. (100.0%)

18101 of 23284 relevant lines covered (77.74%)

0.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/temporal-sdk/src/main/java/io/temporal/client/schedules/ScheduleIntervalSpec.java
1
/*
2
 * Copyright (C) 2022 Temporal Technologies, Inc. All Rights Reserved.
3
 *
4
 * Copyright (C) 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
 *
6
 * Modifications copyright (C) 2017 Uber Technologies, Inc.
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this material except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 *   http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20

21
package io.temporal.client.schedules;
22

23
import com.google.common.base.Preconditions;
24
import java.time.Duration;
25
import java.util.Objects;
26
import javax.annotation.Nonnull;
27
import javax.annotation.Nullable;
28

29
/**
30
 * Specification for scheduling on an interval. Matching times are expressed as
31
 *
32
 * <p>epoch + (n * every) + offset.
33
 */
34
public final class ScheduleIntervalSpec {
35
  private final Duration every;
36
  private final Duration offset;
37

38
  /**
39
   * Construct a ScheduleIntervalSpec
40
   *
41
   * @param every Period to repeat the interval
42
   */
43
  public ScheduleIntervalSpec(@Nonnull Duration every) {
44
    this(every, null);
×
45
  }
×
46

47
  /**
48
   * Construct a ScheduleIntervalSpec
49
   *
50
   * @param every Period to repeat the interval
51
   * @param offset Fixed offset added to each interval period.
52
   */
53
  public ScheduleIntervalSpec(@Nonnull Duration every, @Nullable Duration offset) {
×
54
    this.every = Preconditions.checkNotNull(every);
×
55
    this.offset = offset;
×
56
  }
×
57

58
  /**
59
   * Period to repeat the interval.
60
   *
61
   * @return period to repeat
62
   */
63
  public @Nonnull Duration getEvery() {
64
    return every;
×
65
  }
66

67
  /**
68
   * Fixed offset added to each interval period.
69
   *
70
   * @return offset interval
71
   */
72
  public @Nullable Duration getOffset() {
73
    return offset;
×
74
  }
75

76
  @Override
77
  public String toString() {
78
    return "ScheduleIntervalSpec{" + "every=" + every + ", offset=" + offset + '}';
×
79
  }
80

81
  @Override
82
  public boolean equals(Object o) {
83
    if (this == o) return true;
×
84
    if (o == null || getClass() != o.getClass()) return false;
×
85
    ScheduleIntervalSpec that = (ScheduleIntervalSpec) o;
×
86
    return Objects.equals(every, that.every) && Objects.equals(offset, that.offset);
×
87
  }
88

89
  @Override
90
  public int hashCode() {
91
    return Objects.hash(every, offset);
×
92
  }
93
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc