public class DateRange extends Object
Constructor and Description |
---|
DateRange(String key,
String name,
LocalDateTime from,
LocalDateTime until)
Creates a new DateRange with the given unique key, translated (shown) name and two dates specifying the
range
|
Modifier and Type | Method and Description |
---|---|
void |
applyTo(String field,
Query<?,?,?> qry)
Applies this date range to the given query in the given field.
|
static DateRange |
beforeLastYear()
Creates a date range filtering on everything before the last year.
|
static DateRange |
beforeThisYear()
Creates a date range filtering on everything before this year.
|
LocalDateTime |
getFrom() |
String |
getKey() |
LocalDateTime |
getUntil() |
static DateRange |
lastFiveMinutes()
Creates a date range filtering on the last five minutes.
|
static DateRange |
lastFiveteenMinutes()
Creates a date range filtering on the last 15 minutes.
|
static DateRange |
lastHour()
Creates a date range filtering on the last hour.
|
static DateRange |
lastMonth()
Creates a date range filtering on the last month.
|
static DateRange |
lastTwoHours()
Creates a date range filtering on the last two hours.
|
static DateRange |
lastWeek()
Creates a date range filtering on the last week.
|
static DateRange |
lastYear()
Creates a date range filtering on the last year.
|
static DateRange |
thisMonth()
Creates a date range filtering on the current month.
|
static DateRange |
thisWeek()
Creates a date range filtering on this week.
|
static DateRange |
thisYear()
Creates a date range filtering on the current year.
|
static DateRange |
today()
Creates a date range filtering on "today".
|
String |
toString() |
DateRange |
useLocalDate()
Can be used if the
DateRange should be used on a database field of type LocalDate and not LocalDateTime . |
static DateRange |
yesterday()
Creates a date range filtering on "yesterday".
|
public DateRange(String key, String name, @Nullable LocalDateTime from, @Nullable LocalDateTime until)
key
- the unique name of the ranged used as filter valuename
- the translated name shown to the userfrom
- the lower limit (including) of the rangeuntil
- the upper limit (including) of the rangepublic static DateRange lastFiveMinutes()
public static DateRange lastFiveteenMinutes()
public static DateRange lastHour()
public static DateRange lastTwoHours()
public static DateRange today()
public static DateRange yesterday()
public static DateRange thisWeek()
public static DateRange lastWeek()
public static DateRange thisMonth()
public static DateRange lastMonth()
public static DateRange thisYear()
public static DateRange lastYear()
public static DateRange beforeThisYear()
public static DateRange beforeLastYear()
public DateRange useLocalDate()
DateRange
should be used on a database field of type LocalDate
and not LocalDateTime
.public String getKey()
public LocalDateTime getFrom()
public LocalDateTime getUntil()
public void applyTo(String field, Query<?,?,?> qry)
field
- the field to filter onqry
- the query to expandCopyright © 2018. All rights reserved.