Duration
@Deprecated
public final class Duration
extends java.lang.Object
TimeUnit
.Duration
,
ExpiryPolicy
Modifier and Type | Field and Description |
---|---|
static Duration |
INFINITE
Deprecated.
The infinite
Duration . |
static Duration |
ZERO
Deprecated.
The zero
Duration . |
Constructor and Description |
---|
Duration(long length,
java.util.concurrent.TimeUnit timeUnit)
Deprecated.
Instantiates a new
Duration of the given length and TimeUnit . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Deprecated.
|
long |
getLength()
Deprecated.
Gets the length of time this
Duration represents. |
java.util.concurrent.TimeUnit |
getTimeUnit()
Deprecated.
Gets the
TimeUnit of this Duration . |
int |
hashCode()
Deprecated.
|
boolean |
isInfinite()
Deprecated.
Indicates if this duration represents
INFINITE or an infinite Duration . |
static Duration |
of(long length,
java.util.concurrent.TimeUnit timeUnit)
Deprecated.
Convenience method to create a
Duration with the specified values. |
java.lang.String |
toString()
Deprecated.
|
public static final Duration INFINITE
Duration
.
This constant should be used to express a lack of a concrete expiration time (ie. "eternal").
public static final Duration ZERO
Duration
.public Duration(long length, java.util.concurrent.TimeUnit timeUnit)
Duration
of the given length and TimeUnit
.length
- the duration lengthtimeUnit
- the time unitjava.lang.NullPointerException
- if the given time unit is nulljava.lang.IllegalArgumentException
- if the given length is less than zeropublic static Duration of(long length, java.util.concurrent.TimeUnit timeUnit)
Duration
with the specified values.length
- the duration lengthtimeUnit
- the time unitDuration
Duration(long, TimeUnit)
public long getLength()
Duration
represents.java.lang.IllegalStateException
- if this instance is INFINITE
getTimeUnit()
public java.util.concurrent.TimeUnit getTimeUnit()
TimeUnit
of this Duration
.TimeUnit
of this instancejava.lang.IllegalStateException
- if this instance is INFINITE
getLength()
public boolean isInfinite()
INFINITE
or an infinite Duration
.true
if this instance is the special Forever
valuepublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object