public final class Expiry extends Object
Modifier and Type | Field and Description |
---|---|
static int |
BYTES |
Modifier and Type | Method and Description |
---|---|
Expiry |
addMinutes(int minutes)
Create a new `Expiry` with current offset added the amount of minutes.
|
Expiry |
addSeconds(int seconds)
Create a new `Expiry` with current offset added the amount of seconds.
|
static Expiry |
createNew()
Create a new `Expiry` with an offset of the current time.
|
boolean |
equals(Object o) |
static Expiry |
from(Date date)
Create an `Expiry` from a
Date . |
static Expiry |
from(long value)
Create an `Expiry` from a raw unix timestamp in seconds.
|
static Expiry |
from(Timestamp timestamp)
Create an `Expiry` from a
Timestamp . |
UInt64 |
getValue() |
int |
hashCode() |
String |
toString() |
public static final int BYTES
public Expiry addMinutes(int minutes)
minutes
- minutes to add.
The amount of minutes must be strictly positive.public Expiry addSeconds(int seconds)
seconds
- seconds to add.
The amount of seconds provided must be strictly positive.public static Expiry from(long value)
value
- the raw unix timestamp i.e., seconds since unix epoch.public static Expiry createNew()
public static Expiry from(Date date)
Date
. Note that there is a loss of precision
when using this as a Date
holds milliseconds and the internal
value of a Expiry
is in seconds.date
- the datepublic static Expiry from(Timestamp timestamp)
Timestamp
. Note that there is a loss of precision
when using this as a Timestamp
holds milliseconds and the internal
value of a Expiry
is in seconds.timestamp
- the timestamppublic UInt64 getValue()
Copyright © 2025. All rights reserved.