public class BusinessPeriod extends Object
| Constructor and Description |
|---|
BusinessPeriod(BusinessTemporal start,
BusinessTemporal end)
Builds a new instance of
BusinessPeriod. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
alwaysOpen()
Tells if this period is always open.
|
boolean |
equals(Object obj)
Tells if this business period is equals to the given one.
|
BusinessTemporal |
getEnd()
Get the closing time of this period.
|
CronExpression |
getEndCron()
Get a
CronExpression that triggers at each period closing. |
BusinessTemporal |
getStart()
Get the opening time of this period.
|
CronExpression |
getStartCron()
Get a
CronExpression that triggers at each period opening. |
int |
hashCode() |
boolean |
isInPeriod(Temporal temporal)
Tells if the given temporal lies within this period.
|
static Set<BusinessPeriod> |
merge(Collection<BusinessPeriod> periods)
Merge intersecting or adjacent periods.
|
long |
timeBeforeOpening(Temporal temporal,
ChronoUnit unit)
Gives the amount of time between the given temporal and the next opening of this period.
|
public BusinessPeriod(BusinessTemporal start, BusinessTemporal end)
BusinessPeriod.start - when the period opensend - when the period closespublic boolean alwaysOpen()
public boolean isInPeriod(Temporal temporal)
temporal - the temporalpublic long timeBeforeOpening(Temporal temporal, ChronoUnit unit)
temporal - the temporalunit - the unit in which the result must be givenLong.MAX_VALUE if the business is always open, else the amount of time expressed in unit.public CronExpression getStartCron()
CronExpression that triggers at each period opening.
e.g. if the period is 9am-18pm, the result will be 0 9 * * *null if the period is always open, else the cron expressionpublic CronExpression getEndCron()
CronExpression that triggers at each period closing.
e.g. if the period is 9am-18pm, the result will be 59 18 * * *null if the period is always open, else the cron expressionpublic BusinessTemporal getStart()
public BusinessTemporal getEnd()
public boolean equals(Object obj)
public static Set<BusinessPeriod> merge(Collection<BusinessPeriod> periods)
periods - the periods to mergeCopyright © 2017. All rights reserved.