/**
  * @inheritdoc
  */
 public function isSupported(TemporalField $field)
 {
     if ($field instanceof ChronoField) {
         return $field->isDateBased();
     }
     return $field != null && $field->isSupportedBy($this);
 }
示例#2
0
 /**
  * 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 TemporalField $field the field to check, null returns false
  * @return bool true if the field is supported on this instant, false if not
  */
 public function isSupported(TemporalField $field)
 {
     if ($field instanceof ChronoField) {
         return $field == ChronoField::INSTANT_SECONDS() || $field == ChronoField::NANO_OF_SECOND() || $field == ChronoField::MICRO_OF_SECOND() || $field == ChronoField::MILLI_OF_SECOND();
     }
     return $field != null && $field->isSupportedBy($this);
 }
示例#3
0
 /**
  * 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 TemporalField $field the field to check, null returns false
  * @return true if the field is supported on this year, false if not
  */
 public function isSupported(TemporalField $field)
 {
     if ($field instanceof ChronoField) {
         return $field == ChronoField::YEAR() || $field == ChronoField::YEAR_OF_ERA() || $field == ChronoField::ERA();
     }
     return $field != null && $field->isSupportedBy($this);
 }
示例#4
0
 /**
  * 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 TemporalField $field the field to check, null returns false
  * @return bool true if the field is supported on this offset, false if not
  */
 public function isSupported(TemporalField $field)
 {
     if ($field instanceof ChronoField) {
         return $field == ChronoField::OFFSET_SECONDS();
     }
     return $field != null && $field->isSupportedBy($this);
 }
 public function isSupported(TemporalField $field)
 {
     return $field instanceof ChronoField || $field !== null && $field->isSupportedBy($this);
 }
示例#6
0
 /**
  * Checks if the specified field is supported.
  * <p>
  * This checks if this day-of-week 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 {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} then
  * this method 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 TemporalField $field the field to check, null returns false
  * @return boolean true if the field is supported on this day-of-week, false if not
  */
 public function isSupported(TemporalField $field)
 {
     if ($field instanceof ChronoField) {
         return $field == ChronoField::DAY_OF_WEEK();
     }
     return $field != null && $field->isSupportedBy($this);
 }