/** * Sets the max age of the cookie in seconds. * * @param maxAge The max age * @return This cookie */ default Cookie maxAge(TemporalAmount maxAge) { return maxAge(maxAge.get(ChronoUnit.SECONDS)); }
public static DurationValue durationValue( TemporalAmount value ) { if ( value instanceof Duration ) { return duration( (Duration) value ); } if ( value instanceof Period ) { return duration( (Period) value ); } if ( value instanceof DurationValue ) { return (DurationValue) value; } DurationValue duration = duration( 0, 0, 0, 0 ); for ( TemporalUnit unit : value.getUnits() ) { duration = duration.plus( value.get( unit ), unit ); } return duration; }
@Override public InternationalFixedDate plus(TemporalAmount amount) { return (InternationalFixedDate) amount.addTo(this); }
@Override public InternationalFixedDate minus(TemporalAmount amount) { return (InternationalFixedDate) amount.subtractFrom(this); }
/** * {@inheritDoc} * @throws DateTimeException {@inheritDoc} * @throws ArithmeticException {@inheritDoc} */ @Override public Instant plus(TemporalAmount amount) { return (Instant) amount.addTo(this); }
@Override public DiscordianDate minus(TemporalAmount amount) { return (DiscordianDate) amount.subtractFrom(this); }
@Override public Long convertToDatabaseColumn(TemporalAmount amount) { if (amount == null) return null; return amount.get(ChronoUnit.SECONDS); }
/** * Obtains an instance of {@code Duration} from an amount. * <p> * This obtains a duration based on the specified amount. * A TemporalAmount represents an amount of time, which may be date-based * or time-based, which this factory extracts to a duration. * <p> * The conversion loops around the set of units from the amount and uses * the duration of the unit to calculate the total Duration. * Only a subset of units are accepted by this method. * The unit must either have an exact duration or be ChronoUnit.DAYS which * is treated as 24 hours. If any other units are found then an exception is thrown. * * @param amount the amount to convert, not null * @return a {@code Duration}, not null * @throws DateTimeException if the amount cannot be converted * @throws ArithmeticException if a numeric overflow occurs */ public static Duration from(TemporalAmount amount) { Jdk8Methods.requireNonNull(amount, "amount"); Duration duration = ZERO; for (TemporalUnit unit : amount.getUnits()) { duration = duration.plus(amount.get(unit), unit); } return duration; }
@Override public PaxDate plus(TemporalAmount amount) { return (PaxDate) amount.addTo(this); }
@Override public Symmetry010Date minus(TemporalAmount amount) { return (Symmetry010Date) amount.subtractFrom(this); }
@Override public Long convertToDatabaseColumn(TemporalAmount amount) { if (amount == null) return null; return amount.get(ChronoUnit.MINUTES); }
public static DurationValue durationValue( TemporalAmount value ) { if ( value instanceof Duration ) { return duration( (Duration) value ); } if ( value instanceof Period ) { return duration( (Period) value ); } if ( value instanceof DurationValue ) { return (DurationValue) value; } DurationValue duration = duration( 0, 0, 0, 0 ); for ( TemporalUnit unit : value.getUnits() ) { duration = duration.plus( value.get( unit ), unit ); } return duration; }
@Override public AccountingDate plus(TemporalAmount amount) { return (AccountingDate) amount.addTo(this); }
/** * {@inheritDoc} * @throws DateTimeException {@inheritDoc} * @throws ArithmeticException {@inheritDoc} */ @Override public Instant minus(TemporalAmount amount) { return (Instant) amount.subtractFrom(this); }
@Override public Long convertToDatabaseColumn(TemporalAmount amount) { if (amount == null) return null; return amount.get(ChronoUnit.HOURS); }
@Override public Temporal plus(TemporalAmount amount) { return amount.addTo(this); }
@Override public AccountingDate minus(TemporalAmount amount) { return (AccountingDate) amount.subtractFrom(this); }