Class Period.PeriodBuilder

  • Enclosing class:
    Period

    public static class Period.PeriodBuilder
    extends Object
    A builder of a Period instance that starts at a specified date or datetime.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Period of​(long amount, ChronoUnit unit)
      Creates a new period of the specified amount of time unit and starting at the underlying date or datetime.
      Period of​(long amount, TimeUnit unit)
      Creates a new period of the specified amount of time unit and starting at the underlying date or datetime.
      Period ofDays​(long amount)
      Creates a new period of the specified amount of days and starting at the underlying date or datetime.
      Period ofHours​(long amount)
      Creates a new period of the specified amount of hours and starting at the underlying date or datetime.
      Period ofMonths​(long amount)
      Creates a new period of the specified amount of months and starting at the underlying date or datetime.
      Period ofWeeks​(long amount)
      Creates a new period of the specified amount of weeks and starting at the underlying date or datetime.
      Period ofYears​(long amount)
      Creates a new period of the specified amount of years and starting at the underlying date or datetime.
    • Method Detail

      • of

        public Period of​(long amount,
                         TimeUnit unit)
        Creates a new period of the specified amount of time unit and starting at the underlying date or datetime.
        Parameters:
        amount - the amount of time unit.
        unit - the unit of time in which is expressed the amount.
        Returns:
        a period of the specified amount of time unit.
      • of

        public Period of​(long amount,
                         ChronoUnit unit)
        Creates a new period of the specified amount of time unit and starting at the underlying date or datetime.
        Parameters:
        amount - the amount of time unit.
        unit - the unit of time in which is expressed the amount.
        Returns:
        a period of the specified amount of time unit.
      • ofHours

        public Period ofHours​(long amount)
        Creates a new period of the specified amount of hours and starting at the underlying date or datetime.
        Parameters:
        amount - the amount of hours.
        Returns:
        a period of the specified amount of hours.
      • ofDays

        public Period ofDays​(long amount)
        Creates a new period of the specified amount of days and starting at the underlying date or datetime.
        Parameters:
        amount - the amount of days.
        Returns:
        a period of the specified amount of days.
      • ofWeeks

        public Period ofWeeks​(long amount)
        Creates a new period of the specified amount of weeks and starting at the underlying date or datetime.
        Parameters:
        amount - the amount of weeks.
        Returns:
        a period of the specified amount of weeks.
      • ofMonths

        public Period ofMonths​(long amount)
        Creates a new period of the specified amount of months and starting at the underlying date or datetime.
        Parameters:
        amount - the amount of months.
        Returns:
        a period of the specified amount of months.
      • ofYears

        public Period ofYears​(long amount)
        Creates a new period of the specified amount of years and starting at the underlying date or datetime.
        Parameters:
        amount - the amount of years.
        Returns:
        a period of the specified amount of years.