Class Duration

    • Method Detail

      • nanoseconds

        public static Duration nanoseconds​(long count)
        Constructs a new Duration object representing the specified amount of nanoseconds.
        Parameters:
        count - the amount of nanoseconds
        Returns:
        the newly created Duration object
      • microseconds

        public static Duration microseconds​(long count)
        Constructs a new Duration object representing the specified amount of microseconds.
        Parameters:
        count - the amount of microseconds
        Returns:
        the newly created Duration object
      • milliseconds

        public static Duration milliseconds​(long count)
        Constructs a new Duration object representing the specified amount of milliseconds.
        Parameters:
        count - the amount of milliseconds
        Returns:
        the newly created Duration object
      • seconds

        public static Duration seconds​(long count)
        Constructs a new Duration object representing the specified amount of seconds.
        Parameters:
        count - the amount of seconds
        Returns:
        the newly created Duration object
      • minutes

        public static Duration minutes​(long count)
        Constructs a new Duration object representing the specified amount of minutes.
        Parameters:
        count - the amount of minutes
        Returns:
        the newly created Duration object
      • hours

        public static Duration hours​(long count)
        Constructs a new Duration object representing the specified amount of hours.
        Parameters:
        count - the amount of hours
        Returns:
        the newly created Duration object
      • days

        public static Duration days​(long count)
        Constructs a new Duration object representing the specified amount of days.
        Parameters:
        count - the amount of days
        Returns:
        the newly created Duration object
      • parse

        public static Duration parse​(String duration)
        Parses a given input string to a Duration.
        Parameters:
        duration - the string to parse
        Returns:
        a valid Duration representing the parsed input string
        Throws:
        IllegalArgumentException - if the given input string cannot be parsed correctly
      • getQuantity

        public long getQuantity()
        Gets the quantity of the current Duration object.
        Returns:
        the quantity of the current duration
      • getUnit

        public TimeUnit getUnit()
        Returns the time unit of the current Duration object.
        Returns:
        the unit of the current duration
      • toNanoseconds

        public long toNanoseconds()
        Returns the quantity of the current Duration object in nanoseconds.
        Returns:
        the converted quantity
      • toMicroseconds

        public long toMicroseconds()
        Returns the quantity of the current Duration object in microseconds.
        Returns:
        the converted quantity
      • toMilliseconds

        public long toMilliseconds()
        Returns the quantity of the current Duration object in milliseconds.
        Returns:
        the converted quantity
      • toSeconds

        public long toSeconds()
        Returns the quantity of the current Duration object in seconds.
        Returns:
        the converted quantity
      • toMinutes

        public long toMinutes()
        Returns the quantity of the current Duration object in minutes.
        Returns:
        the converted quantity
      • toHours

        public long toHours()
        Returns the quantity of the current Duration object in hours.
        Returns:
        the converted quantity
      • toDays

        public long toDays()
        Returns the quantity of the current Duration object in days.
        Returns:
        the converted quantity
      • toJavaDuration

        public Duration toJavaDuration()
        Constructs a java.time.Duration from the current Duration object.
        Returns:
        the java.time.Duration representation
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object