Constructor and Description |
---|
DateRangeBuilder(Date dateValue)
Constructor which allows to create DateRange instance from passed date instance.
|
DateRangeBuilder(String expression)
Constructor which allows to create DateRange instance from passed string expression.
|
Modifier and Type | Method and Description |
---|---|
DateRangeBuilder |
set(Class<? extends Date> valueClass)
Configuration method which sets value class,
to indicate desired class of DateRange.getStart and DateRange.getEnd methods.
|
DateRangeBuilder |
set(Integer weekStartDay)
Configuration method which set start of a week
which will be used during DateRange.getStart and DateRange.getEnd calculations.
|
DateRangeBuilder |
set(Locale locale)
Configuration method which set start of a week
which will be used during DateRange.getStart and DateRange.getEnd calculations
from passed locale instance
|
DateRangeBuilder |
set(String datePattern)
Configuration method which sets date pattern which will be used to parse expression
|
DateRangeBuilder |
set(TimeZone timeZone)
Configuration method which sets desired time zone which will be used to calculate DateRange.getStart and DateRange.getEnd.
|
DateRange |
toDateRange()
Returns instance of |
public DateRangeBuilder(Date dateValue)
Constructor which allows to create DateRange instance from passed date instance.
No additional configuration via set
methods is necessary
dateValue
- date instance to create DateRange instancepublic DateRangeBuilder(String expression)
Constructor which allows to create DateRange instance from passed string expression.
It is usually necessary to pass additional configuration through set
methods
expression
- string expression which will be parsed in order to construct instance of DateRangepublic DateRangeBuilder set(String datePattern)
Configuration method which sets date pattern which will be used to parse expression
NOTE: this method only will take effect if expression is in fact formatted date like "1970-01-01".
datePattern
- date pattern which will be used to parse dateSimpleDateFormat
public DateRangeBuilder set(Class<? extends Date> valueClass)
Configuration method which sets value class, to indicate desired class of DateRange.getStart and DateRange.getEnd methods.
NOTE: this method will not take effect if DateRangeBuilder(java.util.Date)
constructor was used.
valueClass
- class instance of which will be returned by DateRange.getStart and DateRange.getEnd methodspublic DateRangeBuilder set(TimeZone timeZone)
Configuration method which sets desired time zone which will be used to calculate DateRange.getStart and DateRange.getEnd.
NOTE: this method will not take effect if DateRangeBuilder(java.util.Date)
constructor was used.
timeZone
- time zone which will be used to calculate DateRange.getStart and DateRange.getStart.public DateRangeBuilder set(Integer weekStartDay)
Configuration method which set start of a week which will be used during DateRange.getStart and DateRange.getEnd calculations.
Should be one of:
Calendar.SUNDAY
, Calendar.MONDAY
NOTE: this method only will take effect if expression is in fact date range expression like "WEEK".
weekStartDay
- week start day to calculate DateRange.getStart and DateRange.getEnd for expressions like "WEEK"public DateRangeBuilder set(Locale locale)
Configuration method which set start of a week which will be used during DateRange.getStart and DateRange.getEnd calculations from passed locale instance
NOTE: This method and set(Integer)
will overwrite each other
so configuration which was set later will be used.
NOTE: this method only will take effect if expression is in fact date range expression like "WEEK".
locale
- locale to calculate DateRange.getStart and DateRange.getEnd for expressions like "WEEK"public DateRange toDateRange() throws InvalidDateRangeExpressionException
Returns instance of DateRange
based on which configuration methods was called
DateRange
InvalidDateRangeExpressionException
- if could not instantiate DateRange
using passed expressionCopyright © 2016. All rights reserved.