TimeRangeFilter
public final class TimeRangeFilter
Specification of time range for read and delete requests.
The time range can be specified in one of the following ways:
-
use
between
for a closed-ended time range, inclusive-exclusive; -
use
before
for a open-ended start time range, end time is exclusive; -
use
after
for a open-ended end time range, start time is inclusive.
Time can be specified in one of the two ways:
-
use
Instant
for a specific point in time such as "2021-01-03 at 10:00 UTC+1"; -
use
LocalDateTime
for a user experienced time concept such as "2021-01-03 at 10 o'clock", without knowing which time zone the user was at that time.Record
without specifying zoneOffset will assume the current system zone offset at query time.
Summary
Public methods |
|
---|---|
static final @NonNull TimeRangeFilter |
Creates a |
static final @NonNull TimeRangeFilter |
after(@NonNull LocalDateTime startTime) Creates a |
static final @NonNull TimeRangeFilter |
Creates a |
static final @NonNull TimeRangeFilter |
before(@NonNull LocalDateTime endTime) Creates a |
static final @NonNull TimeRangeFilter |
Creates a |
static final @NonNull TimeRangeFilter |
between(@NonNull LocalDateTime startTime, @NonNull LocalDateTime endTime) Creates a |
boolean |
|
int |
hashCode() |
Public methods
after
public static final @NonNull TimeRangeFilter after(@NonNull Instant startTime)
Creates a TimeRangeFilter
for a time range after the given startTime
.
Returns | |
---|---|
@NonNull TimeRangeFilter |
a |
after
public static final @NonNull TimeRangeFilter after(@NonNull LocalDateTime startTime)
Creates a TimeRangeFilter
for a time range after the given startTime
.
Parameters | |
---|---|
@NonNull LocalDateTime startTime |
start time of the filter. |
Returns | |
---|---|
@NonNull TimeRangeFilter |
a |
before
public static final @NonNull TimeRangeFilter before(@NonNull Instant endTime)
Creates a TimeRangeFilter
for a time range until the given endTime
.
Returns | |
---|---|
@NonNull TimeRangeFilter |
a |
before
public static final @NonNull TimeRangeFilter before(@NonNull LocalDateTime endTime)
Creates a TimeRangeFilter
for a time range until the given endTime
.
Parameters | |
---|---|
@NonNull LocalDateTime endTime |
end time of the filter. |
Returns | |
---|---|
@NonNull TimeRangeFilter |
a |
between
public static final @NonNull TimeRangeFilter between(@NonNull Instant startTime, @NonNull Instant endTime)
Creates a TimeRangeFilter
for a time range within the Instant
time range [startTime, endTime).
If user created a Record
at 2pm(UTC+1), crossed a time zone and created a new Record
at 3pm(UTC). Filtering between 2pm(UTC) and 6pm(UTC) will include the record at 3pm(UTC) but not the record at 2pm(UTC+1), because 2pm(UTC+1) happened before 2pm(UTC).
Parameters | |
---|---|
@NonNull Instant startTime |
start time of the filter. |
@NonNull Instant endTime |
end time of the filter. |
Returns | |
---|---|
@NonNull TimeRangeFilter |
a |
between
public static final @NonNull TimeRangeFilter between(@NonNull LocalDateTime startTime, @NonNull LocalDateTime endTime)
Creates a TimeRangeFilter
for a time range within the LocalDateTime
range [startTime, endTime).
Parameters | |
---|---|
@NonNull LocalDateTime startTime |
start time of the filter. |
@NonNull LocalDateTime endTime |
end time of the filter. |
Returns | |
---|---|
@NonNull TimeRangeFilter |
a |