This class allows rules for identifying future transitions to be expressed. A rule might be written in many forms:
Implementation Specification
This class is immutable and thread-safe.
Modifier and Type | Class and Description |
---|---|
public static enum | ZoneOffsetTransitionRule.
A definition of the way a local time can be converted to the actual transition date-time. |
Modifier and Type | Field and Description |
---|---|
private final byte | dom
The day-of-month of the month-day of the cutover week. |
private final DayOfWeek | dow
The cutover day-of-week, null to retain the day-of-month. |
private final Month | month
The month of the month-day of the first day of the cutover week. |
private final ZoneOffset | offsetAfter
The offset after the cutover. |
private final ZoneOffset | offsetBefore
The offset before the cutover. |
private static final long | serialVersionUID
Serialization version. |
private final ZoneOffset | standardOffset
The standard offset at the cutover. |
private final LocalTime | time
The cutover time in the 'before' offset. |
private final ZoneOffsetTransitionRule. | timeDefinition
The definition of how the local time should be interpreted. |
private final boolean | timeEndOfDay
Whether the cutover time is midnight at the end of day. |
Access | Constructor and Description |
---|---|
pack-priv | ZoneOffsetTransitionRule(Month
the month of the month-day of the first day of the cutover week, not null month, int the day of the month-day of the cutover week, positive if the week is that
day or later, negative if the week is that day or earlier, counting from the last day of the month,
from -28 to 31 excluding 0 dayOfMonthIndicator, DayOfWeek the required day-of-week, null if the month-day should not be changed dayOfWeek, LocalTime the cutover time in the 'before' offset, not null time, boolean whether the time is midnight at the end of day timeEndOfDay, ZoneOffsetTransitionRule.how to interpret the cutover timeDefinition,the standard offset in force at the cutover, not null standardOffset, ZoneOffset the offset before the cutover, not null offsetBefore, ZoneOffset the offset after the cutover, not null offsetAfter)Creates an instance defining the yearly rule to create transitions between two offsets. |
Modifier and Type | Method and Description |
---|---|
public ZoneOffsetTransition | Returns: the transition instance, not nullthe year to create a transition for, not null year)Creates a transition instance for the specified year. |
public boolean | Returns: true if equalthe other object to compare to, null returns false otherRule)Overrides java. Checks if this object equals another. |
public int | Returns: the day-of-month indicator, from -28 to 31 excluding 0Gets the indicator of the day-of-month of the transition. |
public DayOfWeek | Returns: the day-of-week that the transition occurs, null if the rule defines an exact dateGets the day-of-week of the transition. |
public LocalTime | Returns: the local time of day of the transition, not nullGets the local time of day of the transition which must be checked with
|
public Month | |
public ZoneOffset | |
public ZoneOffset | |
public ZoneOffset | Returns: the standard offset, not nullGets the standard offset in force at the transition. |
public ZoneOffsetTransitionRule. | Returns: the time definition, not nullGets the time definition, specifying how to convert the time to an instant. |
public int | |
public boolean | Returns: whether a local time of midnight is at the start or end of the dayIs the transition local time midnight at the end of day. |
public static ZoneOffsetTransitionRule | Returns: the rule, not nullthe month of the month-day of the first day of the cutover week, not null month, int the day of the month-day of the cutover week, positive if the week is that
day or later, negative if the week is that day or earlier, counting from the last day of the month,
from -28 to 31 excluding 0 dayOfMonthIndicator, DayOfWeek the required day-of-week, null if the month-day should not be changed dayOfWeek, LocalTime the cutover time in the 'before' offset, not null time, boolean whether the time is midnight at the end of day timeEndOfDay, ZoneOffsetTransitionRule.how to interpret the cutover timeDefinition,the standard offset in force at the cutover, not null standardOffset, ZoneOffset the offset before the cutover, not null offsetBefore, ZoneOffset the offset after the cutover, not null offsetAfter)Obtains an instance defining the yearly rule to create transitions between two offsets. |
pack-priv static ZoneOffsetTransitionRule | Returns: the created object, not nullthe input stream, not null in)Reads the state from the stream. |
private void | |
public String | Returns: a string for debugging, not nullOverrides java. Returns a string describing this object. |
pack-priv void | |
private Object | Returns: the replacing object, not nullWrites the object using a dedicated serialized form. |
dom | back to summary |
---|---|
private final byte dom The day-of-month of the month-day of the cutover week.
If positive, it is the start of the week where the cutover can occur.
If negative, it represents the end of the week where cutover can occur.
The value is the number of days from the end of the month, such that
|
dow | back to summary |
---|---|
private final DayOfWeek dow The cutover day-of-week, null to retain the day-of-month. |
month | back to summary |
---|---|
private final Month month The month of the month-day of the first day of the cutover week. The actual date will be adjusted by the dowChange field. |
offsetAfter | back to summary |
---|---|
private final ZoneOffset offsetAfter The offset after the cutover. |
offsetBefore | back to summary |
---|---|
private final ZoneOffset offsetBefore The offset before the cutover. |
serialVersionUID | back to summary |
---|---|
private static final long serialVersionUID Serialization version. |
standardOffset | back to summary |
---|---|
private final ZoneOffset standardOffset The standard offset at the cutover. |
time | back to summary |
---|---|
private final LocalTime time The cutover time in the 'before' offset. |
timeDefinition | back to summary |
---|---|
private final ZoneOffsetTransitionRule. The definition of how the local time should be interpreted. |
timeEndOfDay | back to summary |
---|---|
private final boolean timeEndOfDay Whether the cutover time is midnight at the end of day. |
ZoneOffsetTransitionRule | back to summary |
---|---|
pack-priv ZoneOffsetTransitionRule(Month month, int dayOfMonthIndicator, DayOfWeek dayOfWeek, LocalTime time, boolean timeEndOfDay, ZoneOffsetTransitionRule. Creates an instance defining the yearly rule to create transitions between two offsets.
|
createTransition | back to summary |
---|---|
public ZoneOffsetTransition createTransition(int year) Creates a transition instance for the specified year. Calculations are performed using the ISO-8601 chronology.
|
equals | back to summary |
---|---|
public boolean equals(Object otherRule) Overrides java. Checks if this object equals another. The entire state of the object is compared. |
getDayOfMonthIndicator | back to summary |
---|---|
public int getDayOfMonthIndicator() Gets the indicator of the day-of-month of the transition. If the rule defines an exact date then the day is the month of that date. If the rule defines a week where the transition might occur, then the day defines either the start of the end of the transition week. If the value is positive, then it represents a normal day-of-month, and is the earliest possible date that the transition can be. The date may refer to 29th February which should be treated as 1st March in non-leap years.
If the value is negative, then it represents the number of days back from the
end of the month where
|
getDayOfWeek | back to summary |
---|---|
public DayOfWeek getDayOfWeek() Gets the day-of-week of the transition. If the rule defines an exact date then this returns null. If the rule defines a week where the cutover might occur, then this method returns the day-of-week that the month-day will be adjusted to. If the day is positive then the adjustment is later. If the day is negative then the adjustment is earlier.
|
getLocalTime | back to summary |
---|---|
public LocalTime getLocalTime() Gets the local time of day of the transition which must be checked with
The time is converted into an instant using the time definition.
|
getMonth | back to summary |
---|---|
public Month getMonth() Gets the month of the transition. If the rule defines an exact date then the month is the month of that date. If the rule defines a week where the transition might occur, then the month if the month of either the earliest or latest possible date of the cutover.
|
getOffsetAfter | back to summary |
---|---|
public ZoneOffset getOffsetAfter() Gets the offset after the transition.
|
getOffsetBefore | back to summary |
---|---|
public ZoneOffset getOffsetBefore() Gets the offset before the transition.
|
getStandardOffset | back to summary |
---|---|
public ZoneOffset getStandardOffset() Gets the standard offset in force at the transition.
|
getTimeDefinition | back to summary |
---|---|
public ZoneOffsetTransitionRule. Gets the time definition, specifying how to convert the time to an instant. The local time can be converted to an instant using the standard offset, the wall offset or UTC.
|
hashCode | back to summary |
---|---|
public int hashCode() Overrides java. Returns a suitable hash code.
|
isMidnightEndOfDay | back to summary |
---|---|
public boolean isMidnightEndOfDay() Is the transition local time midnight at the end of day. The transition may be represented as occurring at 24:00.
|
of | back to summary |
---|---|
public static ZoneOffsetTransitionRule of(Month month, int dayOfMonthIndicator, DayOfWeek dayOfWeek, LocalTime time, boolean timeEndOfDay, ZoneOffsetTransitionRule. Obtains an instance defining the yearly rule to create transitions between two offsets.
Applications should normally obtain an instance from
|
readExternal | back to summary |
---|---|
pack-priv static ZoneOffsetTransitionRule readExternal(DataInput in) throws IOException Reads the state from the stream.
|
readObject | back to summary |
---|---|
private void readObject(ObjectInputStream s) throws InvalidObjectException Defend against malicious streams.
|
toString | back to summary |
---|---|
public String toString() Overrides java. Returns a string describing this object. |
writeExternal | back to summary |
---|---|
pack-priv void writeExternal(DataOutput out) throws IOException Writes the state to the stream.
|
writeReplace | back to summary |
---|---|
private Object writeReplace() Writes the object using a dedicated serialized form.
|
Time zone rules are expressed in one of three ways:
Modifier and Type | Field and Description |
---|---|
public static final ZoneOffsetTransitionRule. | STANDARD
The local date-time is expressed in terms of the standard offset. |
public static final ZoneOffsetTransitionRule. | UTC
The local date-time is expressed in terms of the UTC offset. |
public static final ZoneOffsetTransitionRule. | WALL
The local date-time is expressed in terms of the wall offset. |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public LocalDateTime | Returns: the date-time relative to the wall/before offset, not nullthe local date-time, not null dateTime, ZoneOffset the standard offset, not null standardOffset, ZoneOffset the wall offset, not null wallOffset)Converts the specified local date-time to the local date-time actually seen on a wall clock. |
public static ZoneOffsetTransitionRule. | |
public static ZoneOffsetTransitionRule. |
STANDARD | back to summary |
---|---|
public static final ZoneOffsetTransitionRule. The local date-time is expressed in terms of the standard offset. |
UTC | back to summary |
---|---|
public static final ZoneOffsetTransitionRule. The local date-time is expressed in terms of the UTC offset. |
WALL | back to summary |
---|---|
public static final ZoneOffsetTransitionRule. The local date-time is expressed in terms of the wall offset. |
TimeDefinition | back to summary |
---|---|
private TimeDefinition() |
createDateTime | back to summary |
---|---|
public LocalDateTime createDateTime(LocalDateTime dateTime, ZoneOffset standardOffset, ZoneOffset wallOffset) Converts the specified local date-time to the local date-time actually seen on a wall clock. This method converts using the type of this enum. The output is defined relative to the 'before' offset of the transition. The UTC type uses the UTC offset. The STANDARD type uses the standard offset. The WALL type returns the input date-time. The result is intended for use with the wall-offset.
|
valueOf | back to summary |
---|---|
public static ZoneOffsetTransitionRule. |
values | back to summary |
---|---|
public static ZoneOffsetTransitionRule. |