Package oracle.dbtools.plugin.api.conf

## Class TimeDuration

- java.lang.Object
- - oracle.dbtools.plugin.api.conf.TimeDuration

- All Implemented Interfaces:
    `java.lang.Comparable<TimeDuration>`, `java.time.temporal.TemporalAmount`

      public class TimeDuration
      extends java.lang.Object
      implements java.lang.Comparable<TimeDuration>, java.time.temporal.TemporalAmount

  Represents a specification of a time duration. The value is represented textually as an integer followed by one of: "d", "h", "m", or "s", representing days, hours, minutes, or seconds respectively. Milliseconds, microseconds and nanoseconds are represented by "ms","us" and "ns" respectively. If no unit is specified then the default unit of seconds is used.
  Author:
    cdivilly

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TimeDuration​(long duration, java.util.concurrent.TimeUnit unit)` | Instantiate `TimeDuration` instance

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.time.temporal.Temporal` | `addTo​(java.time.temporal.Temporal temporal)` |
    `int` | `compareTo​(TimeDuration o)` |
    `long` | `convertTo​(java.util.concurrent.TimeUnit timeUnit)` | Convert this TimeDuration into the specified `TimeUnit` duration
    `static TimeDuration` | `disabled()` | Obtain a `TimeDuration` instance representing a disabled duration check
    `long` | `duration()` | Return the raw duration amount
    `boolean` | `enabled()` | Indicate if the duration check is enabled or disabled.
    `boolean` | `equals​(java.lang.Object obj)` |
    `boolean` | `exceeded​(long start, long end)` | Test if this duration has been exceeded
    `boolean` | `exceeded​(java.time.Instant start, java.time.Instant end)` | Test if this duration has been exceeded
    `long` | `get​(java.time.temporal.TemporalUnit unit)` |
    `java.util.List<java.time.temporal.TemporalUnit>` | `getUnits()` |
    `int` | `hashCode()` |
    `static TimeDuration` | `parse​(java.lang.String text)` | Parse a textual representation of a `TimeDuration`
    `java.time.temporal.Temporal` | `subtractFrom​(java.time.temporal.Temporal temporal)` |
    `long` | `toMillis()` | Convert this duration to milliseconds
    `java.lang.String` | `toString()` |
    `java.util.concurrent.TimeUnit` | `unit()` | Return the `TimeUnit` of this duration

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TimeDuration

          public TimeDuration​(long duration,
                              java.util.concurrent.TimeUnit unit)

      Instantiate `TimeDuration` instance
      Parameters:
        `duration` - The amount of the duration
        `unit` - The `TimeUnit`

  - ### Method Detail

    - #### compareTo

          public int compareTo​(TimeDuration o)

      Specified by:
        `compareTo` in interface `java.lang.Comparable<TimeDuration>`

    - #### convertTo

          public long convertTo​(java.util.concurrent.TimeUnit timeUnit)

      Convert this TimeDuration into the specified `TimeUnit` duration
      Parameters:
        `timeUnit` - The `TimeUnit` to convert this duration to
      Returns:
        long value representing the duration in the specified `TimeUnit`

    - #### enabled

          public boolean enabled()

      Indicate if the duration check is enabled or disabled. If a TimeDuration is initialized with a negative duration value then the duration check is disabled
      Returns:
        true if this duration is enabled, false otherwise
      Since:
        19.3.0

    - #### duration

          public long duration()

      Return the raw duration amount
      Returns:
        long value indicating the size of the duration

    - #### equals

          public boolean equals​(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### exceeded

          public boolean exceeded​(long start,
                                  long end)

      Test if this duration has been exceeded
      Parameters:
        `start` - The starting timestamp (in epoch milliseconds)
        `end` - The ending timestamp (in epoch milliseconds)
      Returns:
        true if the elapsed time is greater than this duration

    - #### exceeded

          public boolean exceeded​(java.time.Instant start,
                                  java.time.Instant end)

      Test if this duration has been exceeded
      Parameters:
        `start` - The starting `Instant`
        `end` - The ending `Instant`
      Returns:
        true if the elapsed time is greater than this duration

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### toMillis

          public long toMillis()

      Convert this duration to milliseconds
      Returns:
        long value representing the duration in milliseconds

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### unit

          public java.util.concurrent.TimeUnit unit()

      Return the `TimeUnit` of this duration
      Returns:
        `TimeUnit` value

    - #### disabled

          public static TimeDuration disabled()

      Obtain a `TimeDuration` instance representing a disabled duration check
      Returns:
        `TimeDuration` instance with a duration value of -1 and a TimeUnit of SECONDS

    - #### parse

          public static TimeDuration parse​(java.lang.String text)

      Parse a textual representation of a `TimeDuration`

      The value is represented textually as an integer followed by one of: followed by one of "d", "h", "m", or "s", representing days, hours, minutes, or seconds respectively. Milliseconds, microseconds and nanoseconds are represented by "ms","us" and "ns" respectively.

      If no unit is specified then the default unit of seconds is used.

      Parameters:
        `text` - The textual representation to parse
      Returns:
        The equivalent `TimeDuration` value

    - #### get

          public long get​(java.time.temporal.TemporalUnit unit)

      Specified by:
        `get` in interface `java.time.temporal.TemporalAmount`

    - #### getUnits

          public java.util.List<java.time.temporal.TemporalUnit> getUnits()

      Specified by:
        `getUnits` in interface `java.time.temporal.TemporalAmount`

    - #### addTo

          public java.time.temporal.Temporal addTo​(java.time.temporal.Temporal temporal)

      Specified by:
        `addTo` in interface `java.time.temporal.TemporalAmount`

    - #### subtractFrom

          public java.time.temporal.Temporal subtractFrom​(java.time.temporal.Temporal temporal)

      Specified by:
        `subtractFrom` in interface `java.time.temporal.TemporalAmount`