Java Code Examples for java.time.zone.ZoneOffsetTransition#getOffsetBefore()

The following examples show how to use java.time.zone.ZoneOffsetTransition#getOffsetBefore() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChronoZonedDateTimeImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
@Override
public ChronoZonedDateTime<D> withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ChronoZonedDateTimeImpl<>(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 2
Source File: ChronoZonedDateTimeImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public ChronoZonedDateTime<D> withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ChronoZonedDateTimeImpl<>(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 3
Source File: ChronoZonedDateTimeImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public ChronoZonedDateTime<D> withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ChronoZonedDateTimeImpl<>(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 4
Source File: ChronoZonedDateTimeImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public ChronoZonedDateTime<D> withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ChronoZonedDateTimeImpl<>(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 5
Source File: ChronoZonedDateTimeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public ChronoZonedDateTime<D> withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ChronoZonedDateTimeImpl<>(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 6
Source File: ChronoZonedDateTimeImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
@Override
public ChronoZonedDateTime<D> withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ChronoZonedDateTimeImpl<>(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 7
Source File: ChronoZonedDateTimeImpl.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public ChronoZonedDateTime<D> withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ChronoZonedDateTimeImpl<>(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 8
Source File: ChronoZonedDateTimeImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public ChronoZonedDateTime<D> withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ChronoZonedDateTimeImpl<>(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 9
Source File: ChronoZonedDateTimeImpl.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
@Override
public ChronoZonedDateTime<D> withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ChronoZonedDateTimeImpl<>(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 10
Source File: ChronoZonedDateTimeImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public ChronoZonedDateTime<D> withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ChronoZonedDateTimeImpl<>(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 11
Source File: ChronoZonedDateTimeImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public ChronoZonedDateTime<D> withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ChronoZonedDateTimeImpl<>(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 12
Source File: ChronoZonedDateTimeImpl.java    From j2objc with Apache License 2.0 5 votes vote down vote up
@Override
public ChronoZonedDateTime<D> withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ChronoZonedDateTimeImpl<>(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 13
Source File: ZonedDateTime.java    From desugar_jdk_libs with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns a copy of this date-time changing the zone offset to the
 * earlier of the two valid offsets at a local time-line overlap.
 * <p>
 * This method only has any effect when the local time-line overlaps, such as
 * at an autumn daylight savings cutover. In this scenario, there are two
 * valid offsets for the local date-time. Calling this method will return
 * a zoned date-time with the earlier of the two selected.
 * <p>
 * If this method is called when it is not an overlap, {@code this}
 * is returned.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @return a {@code ZonedDateTime} based on this date-time with the earlier offset, not null
 */
@Override
public ZonedDateTime withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(dateTime);
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ZonedDateTime(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 14
Source File: ZonedDateTime.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns a copy of this date-time changing the zone offset to the
 * earlier of the two valid offsets at a local time-line overlap.
 * <p>
 * This method only has any effect when the local time-line overlaps, such as
 * at an autumn daylight savings cutover. In this scenario, there are two
 * valid offsets for the local date-time. Calling this method will return
 * a zoned date-time with the earlier of the two selected.
 * <p>
 * If this method is called when it is not an overlap, {@code this}
 * is returned.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @return a {@code ZonedDateTime} based on this date-time with the earlier offset, not null
 */
@Override
public ZonedDateTime withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(dateTime);
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ZonedDateTime(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 15
Source File: ZonedDateTime.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns a copy of this date-time changing the zone offset to the
 * earlier of the two valid offsets at a local time-line overlap.
 * <p>
 * This method only has any effect when the local time-line overlaps, such as
 * at an autumn daylight savings cutover. In this scenario, there are two
 * valid offsets for the local date-time. Calling this method will return
 * a zoned date-time with the earlier of the two selected.
 * <p>
 * If this method is called when it is not an overlap, {@code this}
 * is returned.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @return a {@code ZonedDateTime} based on this date-time with the earlier offset, not null
 */
@Override
public ZonedDateTime withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(dateTime);
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ZonedDateTime(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 16
Source File: ZonedDateTime.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns a copy of this date-time changing the zone offset to the
 * earlier of the two valid offsets at a local time-line overlap.
 * <p>
 * This method only has any effect when the local time-line overlaps, such as
 * at an autumn daylight savings cutover. In this scenario, there are two
 * valid offsets for the local date-time. Calling this method will return
 * a zoned date-time with the earlier of the two selected.
 * <p>
 * If this method is called when it is not an overlap, {@code this}
 * is returned.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @return a {@code ZonedDateTime} based on this date-time with the earlier offset, not null
 */
@Override
public ZonedDateTime withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(dateTime);
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ZonedDateTime(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 17
Source File: ZonedDateTime.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns a copy of this date-time changing the zone offset to the
 * earlier of the two valid offsets at a local time-line overlap.
 * <p>
 * This method only has any effect when the local time-line overlaps, such as
 * at an autumn daylight savings cutover. In this scenario, there are two
 * valid offsets for the local date-time. Calling this method will return
 * a zoned date-time with the earlier of the two selected.
 * <p>
 * If this method is called when it is not an overlap, {@code this}
 * is returned.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @return a {@code ZonedDateTime} based on this date-time with the earlier offset, not null
 */
@Override
public ZonedDateTime withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(dateTime);
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ZonedDateTime(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 18
Source File: ZonedDateTime.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a copy of this date-time changing the zone offset to the
 * earlier of the two valid offsets at a local time-line overlap.
 * <p>
 * This method only has any effect when the local time-line overlaps, such as
 * at an autumn daylight savings cutover. In this scenario, there are two
 * valid offsets for the local date-time. Calling this method will return
 * a zoned date-time with the earlier of the two selected.
 * <p>
 * If this method is called when it is not an overlap, {@code this}
 * is returned.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @return a {@code ZonedDateTime} based on this date-time with the earlier offset, not null
 */
@Override
public ZonedDateTime withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(dateTime);
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ZonedDateTime(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 19
Source File: ZonedDateTime.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns a copy of this date-time changing the zone offset to the
 * earlier of the two valid offsets at a local time-line overlap.
 * <p>
 * This method only has any effect when the local time-line overlaps, such as
 * at an autumn daylight savings cutover. In this scenario, there are two
 * valid offsets for the local date-time. Calling this method will return
 * a zoned date-time with the earlier of the two selected.
 * <p>
 * If this method is called when it is not an overlap, {@code this}
 * is returned.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @return a {@code ZonedDateTime} based on this date-time with the earlier offset, not null
 */
@Override
public ZonedDateTime withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(dateTime);
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ZonedDateTime(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
Example 20
Source File: ZonedDateTime.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a copy of this date-time changing the zone offset to the
 * earlier of the two valid offsets at a local time-line overlap.
 * <p>
 * This method only has any effect when the local time-line overlaps, such as
 * at an autumn daylight savings cutover. In this scenario, there are two
 * valid offsets for the local date-time. Calling this method will return
 * a zoned date-time with the earlier of the two selected.
 * <p>
 * If this method is called when it is not an overlap, {@code this}
 * is returned.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @return a {@code ZonedDateTime} based on this date-time with the earlier offset, not null
 */
@Override
public ZonedDateTime withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(dateTime);
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ZonedDateTime(dateTime, earlierOffset, zone);
        }
    }
    return this;
}