-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from zero88/feature/wrap-Instant-to-interface
feature(#100): TimeClock interface
- Loading branch information
Showing
9 changed files
with
87 additions
and
30 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
core/src/main/java/io/github/zero88/schedulerx/TimeClock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.github.zero88.schedulerx; | ||
|
||
import java.time.Instant; | ||
|
||
import org.jetbrains.annotations.ApiStatus.Internal; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* Represents for time clock | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
@Internal | ||
public interface TimeClock { | ||
|
||
/** | ||
* Obtains the current instant from the system clock. | ||
* | ||
* @return the current instant using the system clock, not null | ||
*/ | ||
@NotNull Instant now(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
core/src/main/java/io/github/zero88/schedulerx/impl/TimeClockImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.github.zero88.schedulerx.impl; | ||
|
||
import java.time.Instant; | ||
|
||
import org.jetbrains.annotations.ApiStatus.Internal; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import io.github.zero88.schedulerx.TimeClock; | ||
|
||
@Internal | ||
class TimeClockImpl implements TimeClock { | ||
|
||
@Override | ||
public @NotNull Instant now() { | ||
return Instant.now(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters