Class Duration

java.lang.Object
org.ehcache.expiry.Duration

@Deprecated public final class Duration extends Object
Deprecated.
Replaced with Duration
A time duration in a given TimeUnit.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Duration
    Deprecated.
    The infinite Duration.
    static final Duration
    Deprecated.
    The zero Duration.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Duration(long length, TimeUnit timeUnit)
    Deprecated.
    Instantiates a new Duration of the given length and TimeUnit.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Deprecated.
    long
    Deprecated.
    Gets the length of time this Duration represents.
    Deprecated.
    Gets the TimeUnit of this Duration.
    int
    Deprecated.
    boolean
    Deprecated.
    Indicates if this duration represents INFINITE or an infinite Duration.
    static Duration
    of(long length, TimeUnit timeUnit)
    Deprecated.
    Convenience method to create a Duration with the specified values.
    Deprecated.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • INFINITE

      public static final Duration INFINITE
      Deprecated.
      The infinite Duration.

      This constant should be used to express a lack of a concrete expiration time (ie. "eternal").

    • ZERO

      public static final Duration ZERO
      Deprecated.
      The zero Duration.
  • Constructor Details

    • Duration

      public Duration(long length, TimeUnit timeUnit)
      Deprecated.
      Instantiates a new Duration of the given length and TimeUnit.
      Parameters:
      length - the duration length
      timeUnit - the time unit
      Throws:
      NullPointerException - if the given time unit is null
      IllegalArgumentException - if the given length is less than zero
  • Method Details

    • of

      public static Duration of(long length, TimeUnit timeUnit)
      Deprecated.
      Convenience method to create a Duration with the specified values.
      Parameters:
      length - the duration length
      timeUnit - the time unit
      Returns:
      a new Duration
      See Also:
    • getLength

      public long getLength()
      Deprecated.
      Gets the length of time this Duration represents.
      Returns:
      the length of this instance
      Throws:
      IllegalStateException - if this instance is INFINITE
      See Also:
    • getTimeUnit

      public TimeUnit getTimeUnit()
      Deprecated.
      Gets the TimeUnit of this Duration.
      Returns:
      the TimeUnit of this instance
      Throws:
      IllegalStateException - if this instance is INFINITE
      See Also:
    • isInfinite

      public boolean isInfinite()
      Deprecated.
      Indicates if this duration represents INFINITE or an infinite Duration.
      Returns:
      true if this instance is the special Forever value
    • hashCode

      public int hashCode()
      Deprecated.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Deprecated.
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class Object