Package org.cyclos.entities.utils
Class DatePeriod
- java.lang.Object
-
- org.cyclos.entities.utils.DatePeriod
-
@Embeddable public class DatePeriod extends Object
A persistent date period
-
-
Constructor Summary
Constructors Constructor Description DatePeriod()DatePeriod(Date begin, Date end)DatePeriod(Pair<Date,Date> pair)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DatePeriodbegginingAt(Date begin)Returns a period beginning on the given date, with no end datestatic DatePeriodbetween(Date begin, Date end)Returns a period between the given begin and end datesstatic DatePeriodendingAt(Date end)Returns a period ending on the given date, with no begin datebooleanequals(Object obj)DategetBegin()DategetEnd()inthashCode()booleanincludes(Date date)Returns whether the given date is included in this period.booleanisEmpty()static DatePeriodperiodEndingAt(ITimeInterval interval, Date date)static DatePeriodperiodIncluding(ITimeInterval interval, Date date)static DatePeriodperiodStartingAt(ITimeInterval interval, Date date)static DatePeriodpreviousPeriod(ITimeInterval interval, Date date)voidsetBegin(Date begin)voidsetEnd(Date end)StringtoString()
-
-
-
Method Detail
-
begginingAt
public static DatePeriod begginingAt(Date begin)
Returns a period beginning on the given date, with no end date
-
between
public static DatePeriod between(Date begin, Date end)
Returns a period between the given begin and end dates
-
endingAt
public static DatePeriod endingAt(Date end)
Returns a period ending on the given date, with no begin date
-
periodEndingAt
public static DatePeriod periodEndingAt(ITimeInterval interval, Date date)
-
periodIncluding
public static DatePeriod periodIncluding(ITimeInterval interval, Date date)
-
periodStartingAt
public static DatePeriod periodStartingAt(ITimeInterval interval, Date date)
-
previousPeriod
public static DatePeriod previousPeriod(ITimeInterval interval, Date date)
-
getBegin
public Date getBegin()
-
getEnd
public Date getEnd()
-
includes
public boolean includes(Date date)
Returns whether the given date is included in this period. Null begin / end means unbounded. Both ends are inclusive.
-
isEmpty
public boolean isEmpty()
-
setBegin
public void setBegin(Date begin)
-
setEnd
public void setEnd(Date end)
-
-