Class SecurityTime.Builder

All Implemented Interfaces:
Builder<SecurityTime.Builder,SecurityTime>, Supplier<SecurityTime>
Enclosing class:

public static final class SecurityTime.Builder extends Object implements Builder<SecurityTime.Builder,SecurityTime>
Fluent API builder for SecurityTime.
  • Method Details

    • build

      public SecurityTime build()
      Description copied from interface: Builder
      Build the instance from this builder.
      Specified by:
      build in interface Builder<SecurityTime.Builder,SecurityTime>
      instance of the built type
    • timeZone

      public SecurityTime.Builder timeZone(ZoneId zoneId)
      Override current time zone. The time will represent the SAME instant, in an explicit timezone.

      If we are in a UTC time zone and you set the timezone to "Europe/Prague", the time will be shifted by the offset of Prague (e.g. if it is noon right now in UTC, you would get 14:00).

      zoneId - zone id to use for the instance being built
      updated builder instance
    • shiftBySeconds

      public SecurityTime.Builder shiftBySeconds(long seconds)
      Configure a time-shift in seconds, to move the current time to past or future.
      seconds - number of seconds by which we want to shift the system time, may be negative
      updated builder instance
    • value

      public SecurityTime.Builder value(ChronoField field, long value)
      Set an explicit value for one of the time fields (such as ChronoField.YEAR).
      field - field to set
      value - value to set on the field, see javadoc of each field to see possible values
      updated builder instance
    • config

      public SecurityTime.Builder config(Config config)
      Update this builder from configuration. The config should be located on parent key of the following keys (all of them are optional):
      • time-zone: set time zone id (such as Europe/Prague) of desired time zone
      • shift-by-seconds: shiftBySeconds(long)
      • year: set an explicit year value
      • month: set an explicit month value (1-12)
      • day-of-month: set an explicit day of month value (1-31)
      • hour-of-day: set an explicit hour of day value (0-23)
      • minute: set an explicit minute value (0-59)
      • second: set an explicit second value (0-59)
      • millisecond: set an explicit millisecond value (0-999)
      config - configuration to read data from
      updated builder instance