Java Code Examples for java.time.zone.ZoneRules#isFixedOffset()

The following examples show how to use java.time.zone.ZoneRules#isFixedOffset() . 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: ZoneId.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 2
Source File: ZoneId.java    From j2objc with Apache License 2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 3
Source File: ZoneId.java    From jdk8u-dev-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 4
Source File: ZoneId.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 5
Source File: ZoneId.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 6
Source File: ZoneId.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 7
Source File: ZoneId.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 8
Source File: ZoneId.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 9
Source File: ZoneId.java    From Java8CN with Apache License 2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 10
Source File: ZoneId.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 11
Source File: ZoneId.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 12
Source File: ZoneId.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 13
Source File: ZoneId.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 14
Source File: ZoneId.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 15
Source File: ZoneId.java    From desugar_jdk_libs with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 16
Source File: ZoneId.java    From JDKSourceCode1.8 with MIT License 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 17
Source File: ZoneId.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 18
Source File: ZoneId.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}
 
Example 19
Source File: ZoneId.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.
 * <p>
 * The returns a normalized {@code ZoneId} that can be used in place of this ID.
 * The result will have {@code ZoneRules} equivalent to those returned by this object,
 * however the ID returned by {@code getId()} may be different.
 * <p>
 * The normalization checks if the rules of this {@code ZoneId} have a fixed offset.
 * If they do, then the {@code ZoneOffset} equal to that offset is returned.
 * Otherwise {@code this} is returned.
 *
 * @return the time-zone unique ID, not null
 */
public ZoneId normalized() {
    try {
        ZoneRules rules = getRules();
        if (rules.isFixedOffset()) {
            return rules.getOffset(Instant.EPOCH);
        }
    } catch (ZoneRulesException ex) {
        // invalid ZoneRegion is not important to this method
    }
    return this;
}