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 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.
    • timeUnit

      private final TimeUnit timeUnit
      Deprecated.
    • length

      private final long length
      Deprecated.
  • 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
    • Duration

      private Duration(long length, TimeUnit timeUnit, boolean forever)
      Deprecated.
  • 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:
    • checkInfinite

      private void checkInfinite()
      Deprecated.
    • 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