Class CalendarMonthlyBucketService


public class CalendarMonthlyBucketService extends CalendarBucketService
The CalendarMonthlyBucketService is the implementation of CalendarBucketService using a calendar month duration as a time unit. Starting from starDate param, it generates a bucket that begins at the first of the month (that is greater or equal then the startDate) and is large a number of calendar months specified in the timeSize property (mind that, the end of the bucket must be less or equal than the endDate param). At the end the total number of buckets created is totalBuckets = calendarMonthsBetweenParamDates / timeSize Example: startDate = 15/01/2024 endDate = 07/06/2024 calendarMonthsBetweenParamDates = 4 timeSize = 2 totalBuckets = 4 / 2 = 2 buckets (bucket1 from 01/02/2024 to 31/03/2024) (bucket2 from 01/04/2024 to 31/05/2024)
Since:
18.0
  • Constructor Details

    • CalendarMonthlyBucketService

      protected CalendarMonthlyBucketService(Long roughPlanning, TimeUnit timeUnit, Long timeSize)
  • Method Details

    • canBucketBeCreated

      protected boolean canBucketBeCreated(Date startBucketDate, Date endDate)
      Description copied from class: CalendarBucketService
      It establishes whether a bucket can be created
      Specified by:
      canBucketBeCreated in class CalendarBucketService
      Parameters:
      startBucketDate - starting bucket date
      endDate - upper limit end date to establish that a bucket can be created
      Returns:
      a boolean
    • getEndBucketDate

      protected Date getEndBucketDate(Date startBucketDate)
      Description copied from class: CalendarBucketService
      Returns an end date for the bucket creation
      Specified by:
      getEndBucketDate in class CalendarBucketService
      Parameters:
      startBucketDate - starting bucket date
      Returns:
      a date
    • getInitialStartBucketDate

      protected Date getInitialStartBucketDate(Date startDate)
      Description copied from class: CalendarBucketService
      Returns an initial date for the bucket creation
      Specified by:
      getInitialStartBucketDate in class CalendarBucketService
      Parameters:
      startDate - the lower limit for buckets creation
      Returns:
      a date