Class CronTimeManager

java.lang.Object
me.hsgamer.hscore.crontime.CronTimeManager

public class CronTimeManager extends Object
A simple cron-time manager to manage next execution time
  • Field Details

    • LOGGER

      protected static final Logger LOGGER
      The internal logger
  • Constructor Details

    • CronTimeManager

      public CronTimeManager(@NotNull @NotNull List<com.cronutils.model.Cron> cronList)
      Create a new manager
      Parameters:
      cronList - the cron list
    • CronTimeManager

      public CronTimeManager(@NotNull @NotNull com.cronutils.model.Cron... crons)
      Create a new manager
      Parameters:
      crons - the cron list
    • CronTimeManager

      public CronTimeManager(@NotNull @NotNull com.cronutils.model.definition.CronDefinition definition, @NotNull @NotNull List<String> cronStrings)
      Create a new manager
      Parameters:
      definition - the cron definition
      cronStrings - the cron string list
    • CronTimeManager

      public CronTimeManager(@NotNull @NotNull com.cronutils.model.definition.CronDefinition definition, @NotNull @NotNull String... cronStrings)
      Create a new manager
      Parameters:
      definition - the cron definition
      cronStrings - the cron string list
    • CronTimeManager

      public CronTimeManager(@NotNull @NotNull com.cronutils.model.CronType cronType, @NotNull @NotNull List<String> cronStrings)
      Create a new manager
      Parameters:
      cronType - the cron type
      cronStrings - the cron string list
    • CronTimeManager

      public CronTimeManager(@NotNull @NotNull com.cronutils.model.CronType cronType, @NotNull @NotNull String... cronStrings)
      Create a new manager
      Parameters:
      cronType - the cron type
      cronStrings - the cron string list
  • Method Details

    • getNextTime

      @NotNull public @NotNull ZonedDateTime getNextTime(@NotNull @NotNull ZonedDateTime initTime)
      Get the next time from the initial time
      Parameters:
      initTime - the initial time to get the next time
      Returns:
      the next time
    • getNextTime

      @NotNull public @NotNull ZonedDateTime getNextTime()
      Get the next time from now
      Returns:
      the next time
    • getNextInstant

      @NotNull public @NotNull Instant getNextInstant(@NotNull @NotNull Instant initInstant)
      Get the next instant from the initial instant
      Parameters:
      initInstant - the initial instant to get the next instant
      Returns:
      the next instant
    • getNextInstant

      @NotNull public @NotNull Instant getNextInstant()
      Get the next instant from now
      Returns:
      the next instant
    • getNextEpochMillis

      public long getNextEpochMillis(@NotNull @NotNull ZonedDateTime initTime)
      Get the next epoch millis from the initial time
      Parameters:
      initTime - the initial time to get the next time
      Returns:
      the epoch millis
    • getNextEpochMillis

      public long getNextEpochMillis()
      Get the next epoch millis from now
      Returns:
      the epoch millis
    • getNextEpochMillis

      public long getNextEpochMillis(@NotNull @NotNull Instant initInstant)
      Get the next epoch millis from now
      Parameters:
      initInstant - the initial instant to get the next time
      Returns:
      the epoch millis
    • getRemainingMillis

      public long getRemainingMillis(@NotNull @NotNull ZonedDateTime initTime)
      Get the remaining millis from now to the next time
      Parameters:
      initTime - the initial time to get the next time
      Returns:
      the millis
    • getRemainingMillis

      public long getRemainingMillis()
      Get the remaining millis from now to the next time
      Returns:
      the millis
    • getRemainingMillis

      public long getRemainingMillis(@NotNull @NotNull Instant initInstant)
      Get the remaining millis from now to the next time
      Parameters:
      initInstant - the initial instant to get the next time
      Returns:
      the millis
    • getCronList

      @NotNull public @NotNull List<com.cronutils.model.Cron> getCronList()
      Get the cron list
      Returns:
      the cron list