本文整理汇总了Java中java.time.temporal.TemporalField.isDateBased方法的典型用法代码示例。如果您正苦于以下问题:Java TemporalField.isDateBased方法的具体用法?Java TemporalField.isDateBased怎么用?Java TemporalField.isDateBased使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.time.temporal.TemporalField
的用法示例。
在下文中一共展示了TemporalField.isDateBased方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSupported
import java.time.temporal.TemporalField; //导入方法依赖的package包/类
/**
* Checks if the specified field is supported.
* <p>
* This checks if the specified field can be queried on this date.
* If false, then calling the {@link #range(TemporalField) range},
* {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
* methods will throw an exception.
* <p>
* The set of supported fields is defined by the chronology and normally includes
* all {@code ChronoField} date fields.
* <p>
* If the field is not a {@code ChronoField}, then the result of this method
* is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)}
* passing {@code this} as the argument.
* Whether the field is supported is determined by the field.
*
* @param field the field to check, null returns false
* @return true if the field can be queried, false if not
*/
@Override
default boolean isSupported(TemporalField field) {
if (field instanceof ChronoField) {
return field.isDateBased();
}
return field != null && field.isSupportedBy(this);
}