java.time.temporal.Temporal.getLong()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(285)

本文整理了Java中java.time.temporal.Temporal.getLong()方法的一些代码示例,展示了Temporal.getLong()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Temporal.getLong()方法的具体详情如下:
包路径:java.time.temporal.Temporal
类名称:Temporal
方法名:getLong

Temporal.getLong介绍

暂无

代码示例

代码示例来源:origin: neo4j/neo4j

@Override
public final long getLong( TemporalField field )
{
  return temporal().getLong( field );
}

代码示例来源:origin: com.github.seratch/java-time-backport

@Override
public long between(Temporal temporal1, Temporal temporal2) {
  switch(this) {
    case WEEK_BASED_YEARS:
      return Jdk8Methods.safeSubtract(temporal2.getLong(WEEK_BASED_YEAR), temporal1.getLong(WEEK_BASED_YEAR));
    case QUARTER_YEARS:
      return temporal1.until(temporal2, MONTHS) / 3;
    default:
      throw new IllegalStateException("Unreachable");
  }
}

代码示例来源:origin: org.neo4j/neo4j-values

@Override
public final long getLong( TemporalField field )
{
  return temporal().getLong( field );
}

代码示例来源:origin: org.jooq/jooq

private static final long millis(Temporal temporal) {
  // java.sql.* temporal types:
  if (temporal instanceof LocalDate) {
    return Date.valueOf((LocalDate) temporal).getTime();
  }
  else if (temporal instanceof LocalTime) {
    return Time.valueOf((LocalTime) temporal).getTime();
  }
  else if (temporal instanceof LocalDateTime) {
    return Timestamp.valueOf((LocalDateTime) temporal).getTime();
  }
  // OffsetDateTime
  else if (temporal.isSupported(INSTANT_SECONDS)) {
    return 1000 * temporal.getLong(INSTANT_SECONDS) + temporal.getLong(MILLI_OF_SECOND);
  }
  // OffsetTime
  else if (temporal.isSupported(MILLI_OF_DAY)) {
    return temporal.getLong(MILLI_OF_DAY);
  }
  throw fail(temporal, Long.class);
}

代码示例来源:origin: com.github.seratch/java-time-backport

@SuppressWarnings("unchecked")
@Override
public <R extends Temporal> R adjustInto(R temporal, long newValue) {
  long curValue = getFrom(temporal);
  range().checkValidValue(newValue, this);
  return (R) temporal.with(DAY_OF_YEAR, temporal.getLong(DAY_OF_YEAR) + (newValue - curValue));
}
@Override

代码示例来源:origin: com.github.seratch/java-time-backport

@SuppressWarnings("unchecked")
  @Override
  public <R extends Temporal> R adjustInto(R temporal, long newValue) {
    long curValue = getFrom(temporal);
    range().checkValidValue(newValue, this);
    return (R) temporal.with(MONTH_OF_YEAR, temporal.getLong(MONTH_OF_YEAR) + (newValue - curValue) * 3);
  }
},

代码示例来源:origin: com.github.seratch/java-time-backport

if (startInclusive.isSupported(NANO_OF_SECOND) && endExclusive.isSupported(NANO_OF_SECOND)) {
  try {
    long startNos = startInclusive.getLong(NANO_OF_SECOND);
    nanos = endExclusive.getLong(NANO_OF_SECOND) - startNos;
    if (secs > 0 && nanos < 0) {
      nanos += NANOS_PER_SECOND;

代码示例来源:origin: com.addthis/cronus

} else {
  output = output.plus(1, ChronoUnit.HOURS);
  if (output.getLong(ChronoField.EPOCH_DAY) != input.getLong(ChronoField.EPOCH_DAY)) {
    return null;

代码示例来源:origin: com.addthis/cronus

} else {
  output = output.minus(1, ChronoUnit.HOURS);
  if (output.getLong(ChronoField.EPOCH_DAY) != input.getLong(ChronoField.EPOCH_DAY)) {
    return null;

相关文章