本文整理了Java中java.time.temporal.Temporal.range()
方法的一些代码示例,展示了Temporal.range()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Temporal.range()
方法的具体详情如下:
包路径:java.time.temporal.Temporal
类名称:Temporal
方法名:range
暂无
代码示例来源:origin: neo4j/neo4j
@Override
public final ValueRange range( TemporalField field )
{
return temporal().range( field );
}
代码示例来源:origin: org.neo4j/neo4j-values
@Override
public final ValueRange range( TemporalField field )
{
return temporal().range( field );
}
代码示例来源:origin: dremio/dremio-oss
@Override
public Temporal adjustInto(Temporal temporal) {
long adjustedDayOfMonth = Math.min(dayOfMonth, temporal.range(ChronoField.DAY_OF_MONTH).getMaximum());
return temporal.with(ChronoField.DAY_OF_MONTH, adjustedDayOfMonth);
}
};
代码示例来源:origin: com.github.seratch/java-time-backport
@Override
public Temporal adjustInto(Temporal temporal) {
switch (ordinal) {
case 0: return temporal.with(DAY_OF_MONTH, 1);
case 1: return temporal.with(DAY_OF_MONTH, temporal.range(DAY_OF_MONTH).getMaximum());
case 2: return temporal.with(DAY_OF_MONTH, 1).plus(1, MONTHS);
case 3: return temporal.with(DAY_OF_YEAR, 1);
case 4: return temporal.with(DAY_OF_YEAR, temporal.range(DAY_OF_YEAR).getMaximum());
case 5: return temporal.with(DAY_OF_YEAR, 1).plus(1, YEARS);
}
throw new IllegalStateException("Unreachable");
}
}
代码示例来源:origin: org.omnifaces/omniutils
public static TemporalAdjuster nextDayOfMonth(int dayOfMonth) {
validateDayOfMonth(dayOfMonth);
return temporal -> {
int currentDayOfMonth = temporal.get(DAY_OF_MONTH);
if(currentDayOfMonth >= dayOfMonth || temporal.range(DAY_OF_MONTH).getMaximum() == currentDayOfMonth) {
temporal = temporal.with(firstDayOfNextMonth());
}
ValueRange dayRange = temporal.range(DAY_OF_MONTH);
int newDayOfMonth = dayOfMonth;
if (dayRange.getMaximum() < dayOfMonth) {
newDayOfMonth = (int) dayRange.getMaximum();
}
return temporal.with(DAY_OF_MONTH, newDayOfMonth);
};
}
代码示例来源:origin: org.omnifaces/omniutils
public static TemporalAdjuster nextOrSameDayOfMonth(int dayOfMonth) {
validateDayOfMonth(dayOfMonth);
TemporalAdjuster nextDayOfMonth = nextDayOfMonth(dayOfMonth);
return temporal -> {
int currentDayOfMonth = temporal.get(DAY_OF_MONTH);
if (currentDayOfMonth == dayOfMonth || (currentDayOfMonth < dayOfMonth && currentDayOfMonth == temporal.range(DAY_OF_MONTH).getMaximum())) {
return temporal;
}
return temporal.with(nextDayOfMonth);
};
}
代码示例来源:origin: org.threeten/threeten-extra
return (getYear() <= 0 ? ValueRange.of(1, Year.MAX_VALUE + 1) : ValueRange.of(1, Year.MAX_VALUE));
return Temporal.super.range(field);
代码示例来源:origin: com.github.seratch/java-time-backport
return temporal.with(DAY_OF_MONTH, Math.min(temporal.range(DAY_OF_MONTH).getMaximum(), day));
代码示例来源:origin: com.github.seratch/java-time-backport
@Override
public Temporal adjustInto(Temporal temporal) {
if (ordinal >= 0) {
Temporal temp = temporal.with(DAY_OF_MONTH, 1);
int curDow = temp.get(DAY_OF_WEEK);
int dowDiff = (dowValue - curDow + 7) % 7;
dowDiff += (ordinal - 1L) * 7L; // safe from overflow
return temp.plus(dowDiff, DAYS);
} else {
Temporal temp = temporal.with(DAY_OF_MONTH, temporal.range(DAY_OF_MONTH).getMaximum());
int curDow = temp.get(DAY_OF_WEEK);
int daysDiff = dowValue - curDow;
daysDiff = (daysDiff == 0 ? 0 : (daysDiff > 0 ? daysDiff - 7 : daysDiff));
daysDiff -= (-ordinal - 1L) * 7L; // safe from overflow
return temp.plus(daysDiff, DAYS);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!