当前位置: 首页>>代码示例>>Java>>正文


Java TemporalField.isDateBased方法代码示例

本文整理汇总了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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:ChronoLocalDate.java


注:本文中的java.time.temporal.TemporalField.isDateBased方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。