Package org.apache.kafka.streams.kstream
Class Window
- java.lang.Object
-
- org.apache.kafka.streams.kstream.Window
-
- Direct Known Subclasses:
SessionWindow,TimeWindow,UnlimitedWindow
public abstract class Window extends java.lang.ObjectA single window instance, defined by its start and end timestamp.Windowis agnostic if start/end boundaries are inclusive or exclusive; this is defined by concrete window implementations.To specify how
Windowboundaries are defined useWindows. For time semantics, seeTimestampExtractor.- See Also:
Windows,TimeWindow,SessionWindow,UnlimitedWindow,TimestampExtractor
-
-
Constructor Summary
Constructors Constructor Description Window(long startMs, long endMs)Create a new window for the given start and end time.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description longend()Return the end timestamp of this window.java.time.InstantendTime()Return the end time of this window.booleanequals(java.lang.Object obj)inthashCode()abstract booleanoverlap(Window other)Check if the given window overlaps with this window.longstart()Return the start timestamp of this window.java.time.InstantstartTime()Return the start time of this window.java.lang.StringtoString()
-
-
-
Constructor Detail
-
Window
public Window(long startMs, long endMs) throws java.lang.IllegalArgumentExceptionCreate a new window for the given start and end time.- Parameters:
startMs- the start timestamp of the windowendMs- the end timestamp of the window- Throws:
java.lang.IllegalArgumentException- ifstartMsis negative or ifendMsis smaller thanstartMs
-
-
Method Detail
-
start
public long start()
Return the start timestamp of this window.- Returns:
- The start timestamp of this window.
-
end
public long end()
Return the end timestamp of this window.- Returns:
- The end timestamp of this window.
-
startTime
public java.time.Instant startTime()
Return the start time of this window.- Returns:
- The start time of this window.
-
endTime
public java.time.Instant endTime()
Return the end time of this window.- Returns:
- The end time of this window.
-
overlap
public abstract boolean overlap(Window other)
Check if the given window overlaps with this window. Should throw anIllegalArgumentExceptionif theotherwindow has a different type thanthiswindow.- Parameters:
other- another window of the same type- Returns:
trueifotheroverlaps with this window—falseotherwise
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-