public final class ZoneOffsetTransition extends Object implements Comparable<ZoneOffsetTransition>, Serializable
两个偏移过渡通常是一个日光节约割接结果。不连续性通常是在春季和秋季重叠的间隙。ZoneOffsetTransition
模型两偏移之间的过渡。
差距发生在有本地日期时间,根本不存在。一个例子是,当偏移的变化从+03:00
到+04:00
。这可能被描述为“钟会向前移动一小时今晚凌晨一点”。
重叠发生在有两次存在的本地日期时间。一个例子是,当偏移的变化从+04:00
到+03:00
。这可能被描述为“钟会向前移动一个小时今晚凌晨两点的。
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ZoneOffsetTransition transition)
将此过渡到另一个基于过渡瞬间的过渡。
|
boolean |
equals(Object other)
检查这个对象是否等于另一个。
|
LocalDateTime |
getDateTimeAfter()
获取本地过渡日期时间,如用“后”偏移表示的。
|
LocalDateTime |
getDateTimeBefore()
获取本地过渡日期时间,如用“前”偏移表示的。
|
Duration |
getDuration()
获取过渡的持续时间。
|
Instant |
getInstant()
获取过渡瞬间。
|
ZoneOffset |
getOffsetAfter()
转换后得到偏移量。
|
ZoneOffset |
getOffsetBefore()
获取过渡前的偏移量。
|
int |
hashCode()
返回一个合适的哈希代码。
|
boolean |
isGap()
这种过渡表示在本地时间线的间隙。
|
boolean |
isOverlap()
这种过渡表示在本地时间线的重叠。
|
boolean |
isValidOffset(ZoneOffset offset)
检查在此过渡期间是否有效的指定偏移量是否有效。
|
static ZoneOffsetTransition |
of(LocalDateTime transition, ZoneOffset offsetBefore, ZoneOffset offsetAfter)
获取一个定义两个偏移量之间的过渡的实例。
|
long |
toEpochSecond()
获取过渡瞬间作为一个新纪元。
|
String |
toString()
返回描述此对象的字符串。
|
public static ZoneOffsetTransition of(LocalDateTime transition, ZoneOffset offsetBefore, ZoneOffset offsetAfter)
transition
-过渡日期时间的过渡,这实际上从未发生,表示本地的前偏移,不空
offsetBefore
前过渡的偏移,不空
offsetAfter
-和转型后的偏移,不空
IllegalArgumentException
-如果
offsetBefore
和
offsetAfter
相等,或
transition.getNano()
返回非零值
public Instant getInstant()
这是不连续性的瞬间,它被定义为“在”偏移后的第一个瞬间。
方法getInstant()
,getDateTimeBefore()
和getDateTimeAfter()
都代表相同的瞬间。
public long toEpochSecond()
public LocalDateTime getDateTimeBefore()
这是不连续性开始用“前”偏移表示的日期时间。在这一刻,“后”偏移实际上是使用,因此,这个日期时间和“之前”偏移将永远不会发生组合。
“前”日期时间和偏移量的组合表示与“之后”日期时间和偏移量相同的一个瞬间。
public LocalDateTime getDateTimeAfter()
这是新的偏移量应用的不连续性之后的第一次日期时间。
“前”日期时间和偏移量的组合表示与“之后”日期时间和偏移量相同的一个瞬间。
public ZoneOffset getOffsetBefore()
这是偏移在使用前的过渡瞬间。
public ZoneOffset getOffsetAfter()
这是在使用的偏移和过渡后的瞬间。
public Duration getDuration()
在大多数情况下,过渡持续时间是一个小时,然而,这并不总是这样。的持续时间将是积极的差距和负的重叠。时间区域是第二个基础,所以纳秒级的持续时间将是零。
public boolean isGap()
差距发生在有本地日期时间,根本不存在。一个例子是,当偏移的变化从+01:00
到+02:00
。这可能被描述为“钟会向前移动一小时今晚凌晨一点”。
public boolean isOverlap()
重叠发生在有两次存在的本地日期时间。一个例子是,当偏移的变化从+02:00
到+01:00
。这可能被称为“时钟将后一小时今晚凌晨两点的。
public boolean isValidOffset(ZoneOffset offset)
此检查,看看是否给定的偏移量将在过渡的某一点上是有效的。间隙总是会返回错误的。如果偏移是偏移量的前或后偏移量,则将返回一个重叠部分。
offset
-偏移检查、空返回false
public int compareTo(ZoneOffsetTransition transition)
这对每个过渡的时刻。偏移被忽略,使得这个顺序与相等不符。
compareTo
接口
Comparable<ZoneOffsetTransition>
transition
-比较的过渡,不空
public boolean equals(Object other)
整个对象的状态进行了比较。
equals
方法重写,继承类
Object
other
-其他对象相比,空返回false
Object.hashCode()
,
HashMap
public int hashCode()
hashCode
方法重写,继承类
Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.