Package net.jodah.lyra.util
Class Duration
java.lang.Object
net.jodah.lyra.util.Duration
- All Implemented Interfaces:
java.io.Serializable
public class Duration
extends java.lang.Object
implements java.io.Serializable
Duration unit, consisting of length and time unit.
- See Also:
- Serialized Form
-
Field Summary
-
Method Summary
Modifier and Type Method Description static Durationdays(long count)Returns a Duration ofcountdays.booleanequals(java.lang.Object obj)inthashCode()static Durationhours(long count)Returns a Duration ofcounthours.static Durationinf()Returns an infinite duration of Long.MAX_VALUE days.static Durationinfinite()Returns an infinite duration of Long.MAX_VALUE days.static Durationmicroseconds(long count)Returns a Duration ofcountmicroseconds.static Durationmillis(long count)Returns a Duration ofcountmilliseconds.static Durationmilliseconds(long count)Returns a Duration ofcountmilliseconds.static Durationmins(long count)Returns a Duration ofcountminutes.static Durationminutes(long count)Returns a Duration ofcountminutes.static Durationnanos(long count)Returns a Duration ofcountnanoseconds.static Durationnanoseconds(long count)Returns a Duration ofcountnanoseconds.static Durationof(long count, java.util.concurrent.TimeUnit unit)Returns a Duration ofcountunits.static Durationof(java.lang.String duration)Returns a Duration from the parsedduration.static Durationseconds(long count)Returns a Duration ofcountseconds.static Durationsecs(long count)Returns a Duration ofcountseconds.longtoDays()Returns the Duration converted to days.longtoHours()Returns the Duration converted to hours.longtoMicros()Returns the Duration converted to microseconds.longtoMicroseconds()Returns the Duration converted to microseconds.longtoMillis()Returns the Duration converted to milliseconds.longtoMilliseconds()Returns the Duration converted to milliseconds.longtoMins()Returns the Duration converted to minutes.longtoMinutes()Returns the Duration converted to minutes.longtoNanos()Returns the Duration converted to nanoseconds.longtoNanoseconds()Returns the Duration converted to nanoseconds.longtoSeconds()Returns the Duration converted to seconds.longtoSecs()Returns the Duration converted to seconds.java.lang.StringtoString()
-
Field Details
-
Method Details
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
toDays
public long toDays()Returns the Duration converted to days. -
toHours
public long toHours()Returns the Duration converted to hours. -
toMicros
public long toMicros()Returns the Duration converted to microseconds. -
toMicroseconds
public long toMicroseconds()Returns the Duration converted to microseconds. -
toMillis
public long toMillis()Returns the Duration converted to milliseconds. -
toMilliseconds
public long toMilliseconds()Returns the Duration converted to milliseconds. -
toMins
public long toMins()Returns the Duration converted to minutes. -
toMinutes
public long toMinutes()Returns the Duration converted to minutes. -
toNanos
public long toNanos()Returns the Duration converted to nanoseconds. -
toNanoseconds
public long toNanoseconds()Returns the Duration converted to nanoseconds. -
toSeconds
public long toSeconds()Returns the Duration converted to seconds. -
toSecs
public long toSecs()Returns the Duration converted to seconds. -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
days
Returns a Duration ofcountdays. -
hours
Returns a Duration ofcounthours. -
inf
Returns an infinite duration of Long.MAX_VALUE days. -
infinite
Returns an infinite duration of Long.MAX_VALUE days. -
microseconds
Returns a Duration ofcountmicroseconds. -
millis
Returns a Duration ofcountmilliseconds. -
milliseconds
Returns a Duration ofcountmilliseconds. -
mins
Returns a Duration ofcountminutes. -
minutes
Returns a Duration ofcountminutes. -
nanos
Returns a Duration ofcountnanoseconds. -
nanoseconds
Returns a Duration ofcountnanoseconds. -
of
Returns a Duration ofcountunits. -
of
Returns a Duration from the parsedduration. Example:5 s 5 seconds 10m 10 minutes
-
seconds
Returns a Duration ofcountseconds. -
secs
Returns a Duration ofcountseconds.
-