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


Java TemporalField.isSupportedBy方法代码示例

本文整理汇总了Java中java.time.temporal.TemporalField.isSupportedBy方法的典型用法代码示例。如果您正苦于以下问题:Java TemporalField.isSupportedBy方法的具体用法?Java TemporalField.isSupportedBy怎么用?Java TemporalField.isSupportedBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.time.temporal.TemporalField的用法示例。


在下文中一共展示了TemporalField.isSupportedBy方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isSupported

import java.time.temporal.TemporalField; //导入方法依赖的package包/类
@Override
public boolean isSupported(TemporalField field) {
    if (fieldValues.containsKey(field) ||
            (date != null && date.isSupported(field)) ||
            (time != null && time.isSupported(field))) {
        return true;
    }
    return field != null && (field instanceof ChronoField == false) && field.isSupportedBy(this);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:Parsed.java

示例2: isSupported

import java.time.temporal.TemporalField; //导入方法依赖的package包/类
@Override
public boolean isSupported(TemporalField field) {
    if (field instanceof ChronoField) {
        ChronoField f = (ChronoField) field;
        return f.isDateBased() || f.isTimeBased();
    }
    return field != null && field.isSupportedBy(this);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:ChronoLocalDateTimeImpl.java

示例3: isSupported

import java.time.temporal.TemporalField; //导入方法依赖的package包/类
@Override
public boolean isSupported(TemporalField field) {
    return field instanceof ChronoField || (field != null && field.isSupportedBy(this));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:ChronoZonedDateTimeImpl.java

示例4: isSupported

import java.time.temporal.TemporalField; //导入方法依赖的package包/类
/**
 * Checks if the specified field is supported.
 * <p>
 * This checks if this era can be queried for the specified field.
 * If false, then calling the {@link #range(TemporalField) range} and
 * {@link #get(TemporalField) get} methods will throw an exception.
 * <p>
 * If the field is a {@link ChronoField} then the query is implemented here.
 * The {@code ERA} field returns true.
 * All other {@code ChronoField} instances will return false.
 * <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 is supported on this era, false if not
 */
@Override
default boolean isSupported(TemporalField field) {
    if (field instanceof ChronoField) {
        return field == ERA;
    }
    return field != null && field.isSupportedBy(this);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:Era.java

示例5: isSupported

import java.time.temporal.TemporalField; //导入方法依赖的package包/类
/**
 * Checks if the specified field is supported.
 * <p>
 * This checks if this year can be queried for the specified field.
 * If false, then calling the {@link #range(TemporalField) range},
 * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
 * methods will throw an exception.
 * <p>
 * If the field is a {@link ChronoField} then the query is implemented here.
 * The supported fields are:
 * <ul>
 * <li>{@code YEAR_OF_ERA}
 * <li>{@code YEAR}
 * <li>{@code ERA}
 * </ul>
 * All other {@code ChronoField} instances will return false.
 * <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 is supported on this year, false if not
 */
@Override
public boolean isSupported(TemporalField field) {
    if (field instanceof ChronoField) {
        return field == YEAR || field == YEAR_OF_ERA || field == ERA;
    }
    return field != null && field.isSupportedBy(this);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:Year.java

示例6: isSupported

import java.time.temporal.TemporalField; //导入方法依赖的package包/类
/**
 * Checks if the specified field is supported.
 * <p>
 * This checks if this time can be queried for the specified field.
 * If false, then calling the {@link #range(TemporalField) range},
 * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
 * methods will throw an exception.
 * <p>
 * If the field is a {@link ChronoField} then the query is implemented here.
 * The supported fields are:
 * <ul>
 * <li>{@code NANO_OF_SECOND}
 * <li>{@code NANO_OF_DAY}
 * <li>{@code MICRO_OF_SECOND}
 * <li>{@code MICRO_OF_DAY}
 * <li>{@code MILLI_OF_SECOND}
 * <li>{@code MILLI_OF_DAY}
 * <li>{@code SECOND_OF_MINUTE}
 * <li>{@code SECOND_OF_DAY}
 * <li>{@code MINUTE_OF_HOUR}
 * <li>{@code MINUTE_OF_DAY}
 * <li>{@code HOUR_OF_AMPM}
 * <li>{@code CLOCK_HOUR_OF_AMPM}
 * <li>{@code HOUR_OF_DAY}
 * <li>{@code CLOCK_HOUR_OF_DAY}
 * <li>{@code AMPM_OF_DAY}
 * </ul>
 * All other {@code ChronoField} instances will return false.
 * <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 is supported on this time, false if not
 */
@Override
public boolean isSupported(TemporalField field) {
    if (field instanceof ChronoField) {
        return field.isTimeBased();
    }
    return field != null && field.isSupportedBy(this);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:45,代码来源:LocalTime.java

示例7: isSupported

import java.time.temporal.TemporalField; //导入方法依赖的package包/类
/**
 * Checks if the specified field is supported.
 * <p>
 * This checks if this date-time can be queried for the specified field.
 * If false, then calling the {@link #range(TemporalField) range},
 * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
 * methods will throw an exception.
 * <p>
 * If the field is a {@link ChronoField} then the query is implemented here.
 * The supported fields are:
 * <ul>
 * <li>{@code NANO_OF_SECOND}
 * <li>{@code NANO_OF_DAY}
 * <li>{@code MICRO_OF_SECOND}
 * <li>{@code MICRO_OF_DAY}
 * <li>{@code MILLI_OF_SECOND}
 * <li>{@code MILLI_OF_DAY}
 * <li>{@code SECOND_OF_MINUTE}
 * <li>{@code SECOND_OF_DAY}
 * <li>{@code MINUTE_OF_HOUR}
 * <li>{@code MINUTE_OF_DAY}
 * <li>{@code HOUR_OF_AMPM}
 * <li>{@code CLOCK_HOUR_OF_AMPM}
 * <li>{@code HOUR_OF_DAY}
 * <li>{@code CLOCK_HOUR_OF_DAY}
 * <li>{@code AMPM_OF_DAY}
 * <li>{@code DAY_OF_WEEK}
 * <li>{@code ALIGNED_DAY_OF_WEEK_IN_MONTH}
 * <li>{@code ALIGNED_DAY_OF_WEEK_IN_YEAR}
 * <li>{@code DAY_OF_MONTH}
 * <li>{@code DAY_OF_YEAR}
 * <li>{@code EPOCH_DAY}
 * <li>{@code ALIGNED_WEEK_OF_MONTH}
 * <li>{@code ALIGNED_WEEK_OF_YEAR}
 * <li>{@code MONTH_OF_YEAR}
 * <li>{@code PROLEPTIC_MONTH}
 * <li>{@code YEAR_OF_ERA}
 * <li>{@code YEAR}
 * <li>{@code ERA}
 * </ul>
 * All other {@code ChronoField} instances will return false.
 * <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 is supported on this date-time, false if not
 */
@Override
public boolean isSupported(TemporalField field) {
    if (field instanceof ChronoField) {
        ChronoField f = (ChronoField) field;
        return f.isDateBased() || f.isTimeBased();
    }
    return field != null && field.isSupportedBy(this);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:59,代码来源:LocalDateTime.java

示例8: 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

示例9: isSupported

import java.time.temporal.TemporalField; //导入方法依赖的package包/类
/**
 * Checks if the specified field is supported.
 * <p>
 * This checks if this offset can be queried for the specified field.
 * If false, then calling the {@link #range(TemporalField) range} and
 * {@link #get(TemporalField) get} methods will throw an exception.
 * <p>
 * If the field is a {@link ChronoField} then the query is implemented here.
 * The {@code OFFSET_SECONDS} field returns true.
 * All other {@code ChronoField} instances will return false.
 * <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 is supported on this offset, false if not
 */
@Override
public boolean isSupported(TemporalField field) {
    if (field instanceof ChronoField) {
        return field == OFFSET_SECONDS;
    }
    return field != null && field.isSupportedBy(this);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:ZoneOffset.java

示例10: isSupported

import java.time.temporal.TemporalField; //导入方法依赖的package包/类
/**
 * Checks if the specified field is supported.
 * <p>
 * This checks if this year-month can be queried for the specified field.
 * If false, then calling the {@link #range(TemporalField) range},
 * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
 * methods will throw an exception.
 * <p>
 * If the field is a {@link ChronoField} then the query is implemented here.
 * The supported fields are:
 * <ul>
 * <li>{@code MONTH_OF_YEAR}
 * <li>{@code PROLEPTIC_MONTH}
 * <li>{@code YEAR_OF_ERA}
 * <li>{@code YEAR}
 * <li>{@code ERA}
 * </ul>
 * All other {@code ChronoField} instances will return false.
 * <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 is supported on this year-month, false if not
 */
@Override
public boolean isSupported(TemporalField field) {
    if (field instanceof ChronoField) {
        return field == YEAR || field == MONTH_OF_YEAR ||
                field == PROLEPTIC_MONTH || field == YEAR_OF_ERA || field == ERA;
    }
    return field != null && field.isSupportedBy(this);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:36,代码来源:YearMonth.java

示例11: isSupported

import java.time.temporal.TemporalField; //导入方法依赖的package包/类
/**
 * Checks if the specified field is supported.
 * <p>
 * This checks if this instant can be queried for the specified field.
 * If false, then calling the {@link #range(TemporalField) range},
 * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
 * methods will throw an exception.
 * <p>
 * If the field is a {@link ChronoField} then the query is implemented here.
 * The supported fields are:
 * <ul>
 * <li>{@code NANO_OF_SECOND}
 * <li>{@code MICRO_OF_SECOND}
 * <li>{@code MILLI_OF_SECOND}
 * <li>{@code INSTANT_SECONDS}
 * </ul>
 * All other {@code ChronoField} instances will return false.
 * <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 is supported on this instant, false if not
 */
@Override
public boolean isSupported(TemporalField field) {
    if (field instanceof ChronoField) {
        return field == INSTANT_SECONDS || field == NANO_OF_SECOND || field == MICRO_OF_SECOND || field == MILLI_OF_SECOND;
    }
    return field != null && field.isSupportedBy(this);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:34,代码来源:Instant.java

示例12: isSupported

import java.time.temporal.TemporalField; //导入方法依赖的package包/类
/**
 * Checks if the specified field is supported.
 * <p>
 * This checks if this date-time can be queried for the specified field.
 * If false, then calling the {@link #range(TemporalField) range},
 * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
 * methods will throw an exception.
 * <p>
 * If the field is a {@link ChronoField} then the query is implemented here.
 * The supported fields are:
 * <ul>
 * <li>{@code NANO_OF_SECOND}
 * <li>{@code NANO_OF_DAY}
 * <li>{@code MICRO_OF_SECOND}
 * <li>{@code MICRO_OF_DAY}
 * <li>{@code MILLI_OF_SECOND}
 * <li>{@code MILLI_OF_DAY}
 * <li>{@code SECOND_OF_MINUTE}
 * <li>{@code SECOND_OF_DAY}
 * <li>{@code MINUTE_OF_HOUR}
 * <li>{@code MINUTE_OF_DAY}
 * <li>{@code HOUR_OF_AMPM}
 * <li>{@code CLOCK_HOUR_OF_AMPM}
 * <li>{@code HOUR_OF_DAY}
 * <li>{@code CLOCK_HOUR_OF_DAY}
 * <li>{@code AMPM_OF_DAY}
 * <li>{@code DAY_OF_WEEK}
 * <li>{@code ALIGNED_DAY_OF_WEEK_IN_MONTH}
 * <li>{@code ALIGNED_DAY_OF_WEEK_IN_YEAR}
 * <li>{@code DAY_OF_MONTH}
 * <li>{@code DAY_OF_YEAR}
 * <li>{@code EPOCH_DAY}
 * <li>{@code ALIGNED_WEEK_OF_MONTH}
 * <li>{@code ALIGNED_WEEK_OF_YEAR}
 * <li>{@code MONTH_OF_YEAR}
 * <li>{@code PROLEPTIC_MONTH}
 * <li>{@code YEAR_OF_ERA}
 * <li>{@code YEAR}
 * <li>{@code ERA}
 * <li>{@code INSTANT_SECONDS}
 * <li>{@code OFFSET_SECONDS}
 * </ul>
 * All other {@code ChronoField} instances will return false.
 * <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 is supported on this date-time, false if not
 */
@Override
public boolean isSupported(TemporalField field) {
    return field instanceof ChronoField || (field != null && field.isSupportedBy(this));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:57,代码来源:ZonedDateTime.java


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