@Override public boolean isSupported(TemporalUnit unit) { if (unit instanceof ChronoUnit) { return unit == MONTHS || unit == YEARS || unit == DECADES || unit == CENTURIES || unit == MILLENNIA || unit == ERAS; } return unit != null && unit.isSupportedBy(this); }
@Override public boolean isSupported(TemporalUnit unit) { if (unit instanceof ChronoUnit) { return unit == YEARS || unit == DECADES || unit == CENTURIES || unit == MILLENNIA || unit == ERAS; } return unit != null && unit.isSupportedBy(this); }
return unit == YEARS || unit == DECADES || unit == CENTURIES || unit == MILLENNIA || unit == ERAS; return unit != null && unit.isSupportedBy(this);
public boolean isSupported(final TemporalUnit unit) { if (unit instanceof CalendarDateUnit) { return true; } else if (unit instanceof ChronoUnit) { return unit.isTimeBased() || (unit == ChronoUnit.DAYS); } else if (unit != null) { return unit.isSupportedBy(this); } else { return false; } }
@Override public boolean isSupported(TemporalUnit unit) { if (unit instanceof ChronoUnit) { return unit.isTimeBased(); } return unit != null && unit.isSupportedBy(this); }
@Override public boolean isSupported(TemporalUnit unit) { if (unit instanceof ChronoUnit) { return unit.isTimeBased() || unit == DAYS; } return unit != null && unit.isSupportedBy(this); }
public boolean isSupported(final TemporalUnit unit) { if (unit instanceof CalendarDateUnit) { return true; } else if (unit instanceof ChronoUnit) { return unit.isTimeBased() || (unit == ChronoUnit.DAYS); } else if (unit != null) { return unit.isSupportedBy(this); } else { return false; } }
@Override public boolean isSupported(TemporalUnit unit) { if (unit instanceof ChronoUnit) { return unit.isDateBased(); } return unit != null && unit.isSupportedBy(this); }
@Override public boolean isSupported(TemporalUnit unit) { if (unit instanceof ChronoUnit) { return unit.isTimeBased(); } return unit != null && unit.isSupportedBy(this); }
@Override public boolean isSupported(TemporalUnit unit) { if (unit instanceof ChronoUnit) { return unit.isDateBased() || unit.isTimeBased(); } return unit != null && unit.isSupportedBy(this); }
@Override public boolean isSupported(TemporalUnit unit) { if (unit instanceof ChronoUnit) { return unit.isDateBased() || unit.isTimeBased(); } return unit != null && unit.isSupportedBy(this); }
@Override public boolean isSupported(TemporalUnit unit) { if (unit instanceof ChronoUnit) { return unit.isDateBased() || unit.isTimeBased(); } return unit != null && unit.isSupportedBy(this); }
@Override public boolean isSupported(TemporalUnit unit) { if (unit instanceof ChronoUnit) { return unit.isDateBased() || unit.isTimeBased(); } return unit != null && unit.isSupportedBy(this); }
@Override public boolean isSupported(TemporalUnit unit) { if (unit instanceof ChronoUnit) { return unit.isDateBased() || unit.isTimeBased(); } return unit != null && unit.isSupportedBy(this); }
/** * Create an an instance of {@link TimeDelay} with the {@code expectedTime} and the {@code delay} * of a certain {@code unit}. * * @param expectedTime the expected time such as : 1st January 2000 at 12:00 * @param delay delay in the {@code unit} counting from the {@code expectedTime} * @param unit unit of the delay (unsupported units are {@code ChronoUnit.MICROS}, {@code ChronoUnit.NANOS} * and all not supported by {@link LocalTime#isSupported(TemporalUnit)}) * @return a {@link TimeDelay} with the {@code expectedTime} and the {@code delay}, * {@code null} if the {@code expectedTime} is {@code null}. * @throws UnsupportedTemporalTypeException if the unit is not supported */ public static TimeDelay of(LocalTime expectedTime, Long delay, TemporalUnit unit) { TimeDelay result = null; Objects.requireNonNull(unit); if (expectedTime != null) { Duration duration = Duration.of(DEFAULT_DELAY, DELAY_UNIT); if (delay != null) { if (!unit.isSupportedBy(expectedTime) || ChronoUnit.NANOS.equals(unit) || ChronoUnit.MICROS.equals(unit)) { throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } duration = Duration.of(delay, unit); } result = new TimeDelay(expectedTime, duration.toMillis()); } return result; }