Class SecurityTime.Builder

    • Method Detail

      • 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).

        Parameters:
        zoneId - zone id to use for the instance being built
        Returns:
        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.
        Parameters:
        seconds - number of seconds by which we want to shift the system time, may be negative
        Returns:
        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).
        Parameters:
        field - field to set
        value - value to set on the field, see javadoc of each field to see possible values
        Returns:
        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)
        Parameters:
        config - configuration to read data from
        Returns:
        updated builder instance