public class CalendarWindows
extends java.lang.Object
WindowFn
s that windows values into calendar-based windows such as spans
of days, months, or years.
For example, to group data into quarters that change on the 15th, use CalendarWindows.months(3).withStartingMonth(2014, 1).beginningOnDay(15)
.
Modifier and Type | Class and Description |
---|---|
static class |
CalendarWindows.DaysWindows
A
WindowFn that windows elements into periods measured by days. |
static class |
CalendarWindows.MonthsWindows
A
WindowFn that windows elements into periods measured by months. |
static class |
CalendarWindows.YearsWindows
A
WindowFn that windows elements into periods measured by years. |
Constructor and Description |
---|
CalendarWindows() |
Modifier and Type | Method and Description |
---|---|
static CalendarWindows.DaysWindows |
days(int number)
Returns a
WindowFn that windows elements into periods measured by days. |
static CalendarWindows.MonthsWindows |
months(int number)
Returns a
WindowFn that windows elements into periods measured by months. |
static CalendarWindows.DaysWindows |
weeks(int number,
int startDayOfWeek)
Returns a
WindowFn that windows elements into periods measured by weeks. |
static CalendarWindows.YearsWindows |
years(int number)
Returns a
WindowFn that windows elements into periods measured by years. |
public static CalendarWindows.DaysWindows days(int number)
WindowFn
that windows elements into periods measured by days.
For example, CalendarWindows.days(1)
will window elements into separate windows for
each day.
public static CalendarWindows.DaysWindows weeks(int number, int startDayOfWeek)
WindowFn
that windows elements into periods measured by weeks.
For example, CalendarWindows.weeks(1, DateTimeConstants.TUESDAY)
will window
elements into week-long windows starting on Tuesdays.
public static CalendarWindows.MonthsWindows months(int number)
WindowFn
that windows elements into periods measured by months.
For example, CalendarWindows.months(8).withStartingMonth(2014, 1).beginningOnDay(10)
will window elements into 8 month windows where that start on the 10th day of month, and the
first window begins in January 2014.
public static CalendarWindows.YearsWindows years(int number)
WindowFn
that windows elements into periods measured by years.
For example, CalendarWindows.years(1).withTimeZone(DateTimeZone.forId("America/Los_Angeles"))
will window
elements into year-long windows that start at midnight on Jan 1, in the America/Los_Angeles
time zone.