public interface BillingPolicy
START HERE with a call to BillingPolicy.builder() to start creating a policy.
| Modifier and Type | Method and Description |
|---|---|
static PolicyBuilder |
builder()
To create a new policy, call BillingPolicy.builder().
|
CycleType |
getCycleType()
Get the rough billing cycle type for this policy, e.g.
|
boolean |
isDueOn(LocalDate day)
Given a date, determine if this billing policy is falling due on that
date.
|
List<LocalDate> |
upcomingDueDates(LocalDate day,
int howMany)
Figure out which dates are upcoming due dates according to this billing
policy.
|
boolean isDueOn(LocalDate day)
This takes filters into consideration.
day - - the date to checkList<LocalDate> upcomingDueDates(LocalDate day, int howMany)
This takes filters into consideration, which leads to an interesting edge case: If a filter that causes a date under examination to be moved to an date earlier than the supplied date, it will not be returned. Which is what you'd want, since it's not actually "upcoming".
This is inclusive. A bill could fall due on the first day you're checking.
day - - the first date to checkhowMany - - the total number of upcoming dates to checkCycleType getCycleType()
static PolicyBuilder builder()
e.g.:
BillingPolicy payDay = BillingPolicy.builder()
.sameDayEveryMonth(15)
.filter(not(daysOfWeek(SATURDAY, SUNDAY)))
.build();
Copyright © 2017. All rights reserved.