Java Code Examples for org.threeten.bp.temporal.TemporalField#isSupportedBy()
The following examples show how to use
org.threeten.bp.temporal.TemporalField#isSupportedBy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultInterfaceEra.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public boolean isSupported(TemporalField field) { if (field instanceof ChronoField) { return field == ERA; } return field != null && field.isSupportedBy(this); }
Example 2
Source File: ChronoLocalDate.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public boolean isSupported(TemporalField field) { if (field instanceof ChronoField) { return field.isDateBased(); } return field != null && field.isSupportedBy(this); }
Example 3
Source File: ChronoLocalDateTimeImpl.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public boolean isSupported(TemporalField field) { if (field instanceof ChronoField) { return field.isDateBased() || field.isTimeBased(); } return field != null && field.isSupportedBy(this); }
Example 4
Source File: ChronoZonedDateTimeImpl.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public boolean isSupported(TemporalField field) { return field instanceof ChronoField || (field != null && field.isSupportedBy(this)); }
Example 5
Source File: OffsetTime.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 3 votes |
/** * 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} 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 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 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 time, false if not */ @Override public boolean isSupported(TemporalField field) { if (field instanceof ChronoField) { return field.isTimeBased() || field == OFFSET_SECONDS; } return field != null && field.isSupportedBy(this); }
Example 6
Source File: YearMonth.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 3 votes |
/** * 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} 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 {@link #isSupported(TemporalField) supported fields} will return valid * values based on this date-time. * The supported fields are: * <ul> * <li>{@code MONTH_OF_YEAR} * <li>{@code EPOCH_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); }
Example 7
Source File: Instant.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 3 votes |
/** * 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} 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 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); }
Example 8
Source File: MonthDay.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 3 votes |
/** * Checks if the specified field is supported. * <p> * This checks if this month-day 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 {@link #isSupported(TemporalField) supported fields} will return valid * values based on this date-time. * The supported fields are: * <ul> * <li>{@code MONTH_OF_YEAR} * <li>{@code YEAR} * </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 month-day, false if not */ @Override public boolean isSupported(TemporalField field) { if (field instanceof ChronoField) { return field == MONTH_OF_YEAR || field == DAY_OF_MONTH; } return field != null && field.isSupportedBy(this); }
Example 9
Source File: LocalTime.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 3 votes |
/** * 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} 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 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); }
Example 10
Source File: LocalDateTime.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 3 votes |
/** * 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} 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 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 EPOCH_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) { return field.isDateBased() || field.isTimeBased(); } return field != null && field.isSupportedBy(this); }
Example 11
Source File: Year.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 3 votes |
/** * 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} 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 {@link #isSupported(TemporalField) supported fields} will return valid * values based on this date-time. * 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); }
Example 12
Source File: ZoneOffset.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 3 votes |
/** * 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); }
Example 13
Source File: OffsetDateTime.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * 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} 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 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 EPOCH_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)); }
Example 14
Source File: ZonedDateTime.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * 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} 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 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 EPOCH_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)); }