Java 类java.time.temporal.TemporalQuery 实例源码

项目:outland    文件:OffsetDateTimeSerdes.java   
private <T> T toDateObject(String raw, TemporalQuery<T> from) {
  if (raw.contains(":59:60")) {
    // ISO_INSTANT doesn't crash on leap seconds
    TemporalAccessor parse = DateTimeFormatter.ISO_INSTANT.parse(raw);
    if (parse.query(DateTimeFormatter.parsedLeapSecond())) {
      // lazy: push back the second instead
      logger.warn("Exciting! Saw a leap second, shifting the date back 1s, {}", raw);
      return ISO.parse(raw.replace(":59:60", ":59:59"), from);
    }
  }
  return ISO.parse(raw, from);
}
项目:OpenJSharp    文件:DateTimePrintContext.java   
/**
 * Gets a value using a query.
 *
 * @param query  the query to use, not null
 * @return the result, null if not found and optional is true
 * @throws DateTimeException if the type is not available and the section is not optional
 */
<R> R getValue(TemporalQuery<R> query) {
    R result = temporal.query(query);
    if (result == null && optional == 0) {
        throw new DateTimeException("Unable to extract value: " + temporal.getClass());
    }
    return result;
}
项目:jdk8u-jdk    文件:DateTimePrintContext.java   
/**
 * Gets a value using a query.
 *
 * @param query  the query to use, not null
 * @return the result, null if not found and optional is true
 * @throws DateTimeException if the type is not available and the section is not optional
 */
<R> R getValue(TemporalQuery<R> query) {
    R result = temporal.query(query);
    if (result == null && optional == 0) {
        throw new DateTimeException("Unable to extract value: " + temporal.getClass());
    }
    return result;
}
项目:jdk8u-jdk    文件:AbstractDateTimeTest.java   
@Test
public void basicTest_query() {
    for (TemporalAccessor sample : samples()) {
        assertEquals(sample.query(new TemporalQuery<String>() {
            @Override
            public String queryFrom(TemporalAccessor temporal) {
                return "foo";
            }
        }), "foo");
    }
}
项目:openjdk-jdk10    文件:DateTimePrintContext.java   
/**
 * Gets a value using a query.
 *
 * @param query  the query to use, not null
 * @return the result, null if not found and optional is true
 * @throws DateTimeException if the type is not available and the section is not optional
 */
<R> R getValue(TemporalQuery<R> query) {
    R result = temporal.query(query);
    if (result == null && optional == 0) {
        throw new DateTimeException("Unable to extract " +
                query + " from temporal " + temporal);
    }
    return result;
}
项目:openjdk-jdk10    文件:AbstractDateTimeTest.java   
@Test
public void basicTest_query() {
    for (TemporalAccessor sample : samples()) {
        assertEquals(sample.query(new TemporalQuery<String>() {
            @Override
            public String queryFrom(TemporalAccessor temporal) {
                return "foo";
            }
        }), "foo");
    }
}
项目:openjdk9    文件:DateTimePrintContext.java   
/**
 * Gets a value using a query.
 *
 * @param query  the query to use, not null
 * @return the result, null if not found and optional is true
 * @throws DateTimeException if the type is not available and the section is not optional
 */
<R> R getValue(TemporalQuery<R> query) {
    R result = temporal.query(query);
    if (result == null && optional == 0) {
        throw new DateTimeException("Unable to extract " +
                query + " from temporal " + temporal);
    }
    return result;
}
项目:openjdk9    文件:AbstractDateTimeTest.java   
@Test
public void basicTest_query() {
    for (TemporalAccessor sample : samples()) {
        assertEquals(sample.query(new TemporalQuery<String>() {
            @Override
            public String queryFrom(TemporalAccessor temporal) {
                return "foo";
            }
        }), "foo");
    }
}
项目:Java8CN    文件:DateTimePrintContext.java   
/**
 * Gets a value using a query.
 *
 * @param query  the query to use, not null
 * @return the result, null if not found and optional is true
 * @throws DateTimeException if the type is not available and the section is not optional
 */
<R> R getValue(TemporalQuery<R> query) {
    R result = temporal.query(query);
    if (result == null && optional == 0) {
        throw new DateTimeException("Unable to extract value: " + temporal.getClass());
    }
    return result;
}
项目:jdk8u_jdk    文件:DateTimePrintContext.java   
/**
 * Gets a value using a query.
 *
 * @param query  the query to use, not null
 * @return the result, null if not found and optional is true
 * @throws DateTimeException if the type is not available and the section is not optional
 */
<R> R getValue(TemporalQuery<R> query) {
    R result = temporal.query(query);
    if (result == null && optional == 0) {
        throw new DateTimeException("Unable to extract value: " + temporal.getClass());
    }
    return result;
}
项目:jdk8u_jdk    文件:AbstractDateTimeTest.java   
@Test
public void basicTest_query() {
    for (TemporalAccessor sample : samples()) {
        assertEquals(sample.query(new TemporalQuery<String>() {
            @Override
            public String queryFrom(TemporalAccessor temporal) {
                return "foo";
            }
        }), "foo");
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:DateTimePrintContext.java   
/**
 * Gets a value using a query.
 *
 * @param query  the query to use, not null
 * @return the result, null if not found and optional is true
 * @throws DateTimeException if the type is not available and the section is not optional
 */
<R> R getValue(TemporalQuery<R> query) {
    R result = temporal.query(query);
    if (result == null && optional == 0) {
        throw new DateTimeException("Unable to extract value: " + temporal.getClass());
    }
    return result;
}
项目:lookaside_java-1.8.0-openjdk    文件:AbstractDateTimeTest.java   
@Test
public void basicTest_query() {
    for (TemporalAccessor sample : samples()) {
        assertEquals(sample.query(new TemporalQuery<String>() {
            @Override
            public String queryFrom(TemporalAccessor temporal) {
                return "foo";
            }
        }), "foo");
    }
}
项目:OpenJSharp    文件:DateTimeFormatter.java   
/** Constructor. */
public ClassicFormat(DateTimeFormatter formatter, TemporalQuery<?> parseType) {
    this.formatter = formatter;
    this.parseType = parseType;
}
项目:OpenJSharp    文件:DateTimeFormatterBuilder.java   
ZoneIdPrinterParser(TemporalQuery<ZoneId> query, String description) {
    this.query = query;
    this.description = description;
}
项目:jdk8u-jdk    文件:DateTimeFormatter.java   
/** Constructor. */
public ClassicFormat(DateTimeFormatter formatter, TemporalQuery<?> parseType) {
    this.formatter = formatter;
    this.parseType = parseType;
}
项目:jdk8u-jdk    文件:DateTimeFormatterBuilder.java   
ZoneIdPrinterParser(TemporalQuery<ZoneId> query, String description) {
    this.query = query;
    this.description = description;
}
项目:jdk8u-jdk    文件:TCKYearMonth.java   
@Test(dataProvider="query")
public <T> void test_query(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(temporal.query(query), expected);
}
项目:jdk8u-jdk    文件:TCKYearMonth.java   
@Test(dataProvider="query")
public <T> void test_queryFrom(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(query.queryFrom(temporal), expected);
}
项目:jdk8u-jdk    文件:TCKYear.java   
@Test(dataProvider="query")
public <T> void test_query(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(temporal.query(query), expected);
}
项目:jdk8u-jdk    文件:TCKYear.java   
@Test(dataProvider="query")
public <T> void test_queryFrom(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(query.queryFrom(temporal), expected);
}
项目:jdk8u-jdk    文件:TCKOffsetDateTime.java   
@Test(dataProvider="query")
public <T> void test_query(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(temporal.query(query), expected);
}
项目:jdk8u-jdk    文件:TCKOffsetDateTime.java   
@Test(dataProvider="query")
public <T> void test_queryFrom(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(query.queryFrom(temporal), expected);
}
项目:jdk8u-jdk    文件:TCKDayOfWeek.java   
@Test(dataProvider="query")
public <T> void test_query(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(temporal.query(query), expected);
}
项目:jdk8u-jdk    文件:TCKDayOfWeek.java   
@Test(dataProvider="query")
public <T> void test_queryFrom(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(query.queryFrom(temporal), expected);
}
项目:jdk8u-jdk    文件:TCKLocalDateTime.java   
@Test(dataProvider="query")
public <T> void test_query(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(temporal.query(query), expected);
}
项目:jdk8u-jdk    文件:TCKLocalDateTime.java   
@Test(dataProvider="query")
public <T> void test_queryFrom(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(query.queryFrom(temporal), expected);
}
项目:jdk8u-jdk    文件:TCKLocalDate.java   
@Test(dataProvider="query")
public <T> void test_query(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(temporal.query(query), expected);
}
项目:jdk8u-jdk    文件:TCKLocalDate.java   
@Test(dataProvider="query")
public <T> void test_queryFrom(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(query.queryFrom(temporal), expected);
}
项目:jdk8u-jdk    文件:TCKLocalTime.java   
@Test(dataProvider="query")
public <T> void test_query(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(temporal.query(query), expected);
}
项目:jdk8u-jdk    文件:TCKLocalTime.java   
@Test(dataProvider="query")
public <T> void test_queryFrom(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(query.queryFrom(temporal), expected);
}
项目:jdk8u-jdk    文件:TCKInstant.java   
@Test(dataProvider="query")
public <T> void test_query(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(temporal.query(query), expected);
}
项目:jdk8u-jdk    文件:TCKInstant.java   
@Test(dataProvider="query")
public <T> void test_queryFrom(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(query.queryFrom(temporal), expected);
}
项目:jdk8u-jdk    文件:TCKDateTimeFormatter.java   
@Test(expectedExceptions=NullPointerException.class)
public void test_parse_Query_String_nullRule() throws Exception {
    DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
    test.parse("30", (TemporalQuery<?>) null);
}
项目:jdk8u-jdk    文件:TCKDateTimeFormatter.java   
@Test(expectedExceptions=NullPointerException.class)
public void test_parseBest_String_nullRules() throws Exception {
    DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
    test.parseBest("30", (TemporalQuery<?>[]) null);
}
项目:jdk8u-jdk    文件:TCKDateTimeFormatter.java   
@Test(expectedExceptions=IllegalArgumentException.class)
public void test_parseBest_String_zeroRules() throws Exception {
    DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
    test.parseBest("30", new TemporalQuery<?>[0]);
}
项目:jdk8u-jdk    文件:TCKOffsetTime.java   
@Test(dataProvider="query")
public <T> void test_query(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(temporal.query(query), expected);
}
项目:jdk8u-jdk    文件:TCKOffsetTime.java   
@Test(dataProvider="query")
public <T> void test_queryFrom(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(query.queryFrom(temporal), expected);
}
项目:jdk8u-jdk    文件:TCKMonthDay.java   
@Test(dataProvider="query")
public <T> void test_query(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(temporal.query(query), expected);
}
项目:jdk8u-jdk    文件:TCKMonthDay.java   
@Test(dataProvider="query")
public <T> void test_queryFrom(TemporalAccessor temporal, TemporalQuery<T> query, T expected) {
    assertEquals(query.queryFrom(temporal), expected);
}