Class PeriodBuilderImpl

    • Method Detail

      • create

        public Period create​(long duration)
        Description copied from interface: PeriodBuilder
        Create a period of the given duration using the current system time as the reference time.
        Specified by:
        create in interface PeriodBuilder
        Parameters:
        duration - the duration in milliseconds from the current time to the target time. A negative duration indicates a time in the past
        Returns:
        a Period that represents the duration
      • approximateDurationOf

        public long approximateDurationOf​(TimeUnit unit)
      • createWithReferenceDate

        public Period createWithReferenceDate​(long duration,
                                              long referenceDate)
        Description copied from interface: PeriodBuilder
        Create a period of the given duration using the provided reference date.
        Specified by:
        createWithReferenceDate in interface PeriodBuilder
        Parameters:
        duration - the duration in milliseconds from the referenced time to the target time. A negative duration indicates a time before the reference time
        referenceDate - the reference date from which to compute the period
        Returns:
        a Period that represents the duration
      • withTimeZone

        public PeriodBuilder withTimeZone​(java.util.TimeZone timeZone)
        Description copied from interface: PeriodBuilder
        Returns a new PeriodBuilder that computes periods starting at dates in the provided time zone.
        Specified by:
        withTimeZone in interface PeriodBuilder
      • withLocale

        public PeriodBuilder withLocale​(java.lang.String localeName)
        Description copied from interface: PeriodBuilder
        Returns a new PeriodBuilder that uses the provided locale to determine what periods are available for use.
        Specified by:
        withLocale in interface PeriodBuilder
      • handleCreate

        protected abstract Period handleCreate​(long duration,
                                               long referenceDate,
                                               boolean inPast)