Class Duration


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

      Fields 
      Modifier and Type Field Description
      static Duration INFINITE
      Deprecated.
      The infinite Duration.
      private long length
      Deprecated.
       
      private java.util.concurrent.TimeUnit timeUnit
      Deprecated.
       
      static Duration ZERO
      Deprecated.
      The zero Duration.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        Duration​(long length, java.util.concurrent.TimeUnit timeUnit)
      Deprecated.
      Instantiates a new Duration of the given length and TimeUnit.
      private Duration​(long length, java.util.concurrent.TimeUnit timeUnit, boolean forever)
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      private void checkInfinite()
      Deprecated.
       
      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.
      • Methods inherited from class java.lang.Object

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

      • 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 java.util.concurrent.TimeUnit timeUnit
        Deprecated.
      • length

        private final long length
        Deprecated.
    • Constructor Detail

      • Duration

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

        private Duration​(long length,
                         java.util.concurrent.TimeUnit timeUnit,
                         boolean forever)
        Deprecated.
    • Method Detail

      • of

        public static Duration of​(long length,
                                  java.util.concurrent.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:
        Duration(long, TimeUnit)
      • getLength

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

        public java.util.concurrent.TimeUnit getTimeUnit()
        Deprecated.
        Gets the TimeUnit of this Duration.
        Returns:
        the TimeUnit of this instance
        Throws:
        java.lang.IllegalStateException - if this instance is INFINITE
        See Also:
        getLength()
      • 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 java.lang.Object
      • equals

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

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