public class Duration extends Object implements Comparable<Duration>, Serializable
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Duration other) |
static Duration |
days(long count)
Constructs a new
Duration object representing the specified amount of days. |
boolean |
equals(Object obj) |
long |
getQuantity()
Gets the quantity of the current
Duration object. |
TimeUnit |
getUnit()
|
int |
hashCode() |
static Duration |
hours(long count)
Constructs a new
Duration object representing the specified amount of hours. |
static Duration |
microseconds(long count)
Constructs a new
Duration object representing the specified amount of microseconds. |
static Duration |
milliseconds(long count)
Constructs a new
Duration object representing the specified amount of milliseconds. |
static Duration |
minutes(long count)
Constructs a new
Duration object representing the specified amount of minutes. |
static Duration |
nanoseconds(long count)
Constructs a new
Duration object representing the specified amount of nanoseconds. |
static Duration |
parse(String duration)
Parses a given input string to a
Duration. |
static Duration |
seconds(long count)
Constructs a new
Duration object representing the specified amount of seconds. |
long |
toDays()
Returns the quantity of the current
Duration object in days. |
long |
toHours()
Returns the quantity of the current
Duration object in hours. |
Duration |
toJavaDuration()
Constructs a
java.time.Duration from the current Duration object. |
long |
toMicroseconds()
Returns the quantity of the current
Duration object in microseconds. |
long |
toMilliseconds()
Returns the quantity of the current
Duration object in milliseconds. |
long |
toMinutes()
Returns the quantity of the current
Duration object in minutes. |
long |
toNanoseconds()
Returns the quantity of the current
Duration object in nanoseconds. |
long |
toSeconds()
Returns the quantity of the current
Duration object in seconds. |
String |
toString() |
public static Duration nanoseconds(long count)
Duration object representing the specified amount of nanoseconds.count - the amount of nanosecondsDuration objectpublic static Duration microseconds(long count)
Duration object representing the specified amount of microseconds.count - the amount of microsecondsDuration objectpublic static Duration milliseconds(long count)
Duration object representing the specified amount of milliseconds.count - the amount of millisecondsDuration objectpublic static Duration seconds(long count)
Duration object representing the specified amount of seconds.count - the amount of secondsDuration objectpublic static Duration minutes(long count)
Duration object representing the specified amount of minutes.count - the amount of minutesDuration objectpublic static Duration hours(long count)
Duration object representing the specified amount of hours.count - the amount of hoursDuration objectpublic static Duration days(long count)
Duration object representing the specified amount of days.count - the amount of daysDuration objectpublic static Duration parse(String duration)
Duration.duration - the string to parseDuration representing the parsed input stringIllegalArgumentException - if the given input string cannot be parsed correctlypublic long getQuantity()
Duration object.public TimeUnit getUnit()
public long toNanoseconds()
Duration object in nanoseconds.public long toMicroseconds()
Duration object in microseconds.public long toMilliseconds()
Duration object in milliseconds.public long toSeconds()
Duration object in seconds.public long toMinutes()
Duration object in minutes.public long toHours()
Duration object in hours.public long toDays()
Duration object in days.public Duration toJavaDuration()
java.time.Duration from the current Duration object.java.time.Duration representationpublic int compareTo(Duration other)
compareTo in interface Comparable<Duration>Copyright © 2011. All rights reserved.