Class DateTimeRange
java.lang.Object
cloud.opencode.base.date.range.DateTimeRange
Deprecated.
DateTimeRange - Compatibility wrapper for LocalDateTimeRange
日期时间范围 - LocalDateTimeRange的兼容性包装器
This class provides a compatibility layer for the extra.LocalDateTimeRange class, offering the same functionality with a simpler name for legacy code compatibility.
此类为extra.LocalDateTimeRange类提供兼容层,使用更简单的名称以兼容遗留代码。
Features | 主要功能:
- Compatibility wrapper for LocalDateTimeRange - LocalDateTimeRange的兼容性包装器
- Containment and overlap checking - 包含和重叠检查
- Intersection, span, and gap operations - 交集、跨度和间隙操作
- Conversion to other range types - 转换为其他范围类型
Usage Examples | 使用示例:
DateTimeRange range = DateTimeRange.of(
LocalDateTime.of(2024, 1, 1, 0, 0),
LocalDateTime.of(2024, 12, 31, 23, 59, 59)
);
Duration duration = range.toDuration();
boolean contains = range.contains(LocalDateTime.now());
Security | 安全性:
- Thread-safe: Yes (immutable, delegates to immutable LocalDateTimeRange) - 线程安全: 是(不可变,委托给不可变的LocalDateTimeRange)
- Null-safe: No (delegates null handling to LocalDateTimeRange) - 空值安全: 否(空值处理委托给LocalDateTimeRange)
- Since:
- JDK 25, opencode-base-date V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanabuts(DateTimeRange other) Deprecated.booleancontains(LocalDateTime dateTime) Deprecated.static DateTimeRangeempty()Deprecated.Creates an empty DateTimeRange at the current time 在当前时间创建空日期时间范围static DateTimeRangeempty(LocalDateTime dateTime) Deprecated.Creates an empty DateTimeRange at the specified time 在指定时间创建空日期时间范围booleanencloses(DateTimeRange other) Deprecated.booleanDeprecated.static DateTimeRangefrom(LocalDateTimeRange range) Deprecated.Creates a DateTimeRange from a LocalDateTimeRange 从LocalDateTimeRange创建DateTimeRangegap(DateTimeRange other) Deprecated.getEnd()Deprecated.getStart()Deprecated.inthashCode()Deprecated.intersection(DateTimeRange other) Deprecated.booleanisEmpty()Deprecated.static DateTimeRangeof(LocalDateTime start, Duration duration) Deprecated.Creates a DateTimeRange with a duration 使用时长创建日期时间范围static DateTimeRangeof(LocalDateTime start, LocalDateTime end) Deprecated.Creates a DateTimeRange 创建日期时间范围booleanoverlaps(DateTimeRange other) Deprecated.span(DateTimeRange other) Deprecated.Deprecated.Converts to DateRange (date portion only) 转换为DateRange(仅日期部分)Deprecated.Deprecated.Converts to LocalDateTimeRange 转换为LocalDateTimeRangetoString()Deprecated.
-
Method Details
-
of
Deprecated.Creates a DateTimeRange 创建日期时间范围- Parameters:
start- the start datetime | 起始日期时间end- the end datetime | 结束日期时间- Returns:
- the DateTimeRange | 日期时间范围
-
of
Deprecated.Creates a DateTimeRange with a duration 使用时长创建日期时间范围- Parameters:
start- the start datetime | 起始日期时间duration- the duration | 时长- Returns:
- the DateTimeRange | 日期时间范围
-
empty
Deprecated.Creates an empty DateTimeRange at the current time 在当前时间创建空日期时间范围- Returns:
- empty DateTimeRange | 空日期时间范围
-
empty
Deprecated.Creates an empty DateTimeRange at the specified time 在指定时间创建空日期时间范围- Parameters:
dateTime- the datetime | 日期时间- Returns:
- empty DateTimeRange | 空日期时间范围
-
from
Deprecated.Creates a DateTimeRange from a LocalDateTimeRange 从LocalDateTimeRange创建DateTimeRange- Parameters:
range- the LocalDateTimeRange | LocalDateTimeRange- Returns:
- the DateTimeRange | 日期时间范围
-
getStart
Deprecated. -
getEnd
Deprecated. -
toDuration
Deprecated. -
isEmpty
public boolean isEmpty()Deprecated. -
contains
Deprecated. -
overlaps
Deprecated. -
encloses
Deprecated. -
abuts
Deprecated. -
intersection
Deprecated. -
span
Deprecated. -
gap
Deprecated. -
toLocalDateTimeRange
Deprecated.Converts to LocalDateTimeRange 转换为LocalDateTimeRange- Returns:
- the LocalDateTimeRange | LocalDateTimeRange
-
toDateRange
Deprecated.Converts to DateRange (date portion only) 转换为DateRange(仅日期部分)- Returns:
- the DateRange | 日期范围
-
equals
-
hashCode
-
toString
-
LocalDateTimeRangeinstead