|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbiweekly.util.Duration
public class Duration
Represents a period of time (for example, "2 hours and 30 minutes").
This class is immutable. Use the Duration.Builder
class to
construct a new instance, or the parse(java.lang.String)
method to parse a duration
string.
Examples:
Duration duration = new Duration.Builder().hours(2).minutes(30).build(); Duration duration = Duration.parse("PT2H30M");
Nested Class Summary | |
---|---|
static class |
Duration.Builder
Builds Duration objects. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
Integer |
getDays()
Gets the number of days. |
Integer |
getHours()
Gets the number of hours. |
Integer |
getMinutes()
Gets the number of minutes. |
Integer |
getSeconds()
Gets the number of seconds. |
Integer |
getWeeks()
Gets the number of weeks. |
int |
hashCode()
|
boolean |
hasTime()
Determines if any time components are present. |
boolean |
isPrior()
Gets whether the duration is negative. |
static Duration |
parse(String value)
Parses a duration string. |
String |
toString()
Converts the duration to its string representation. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static Duration parse(String value)
value
- the duration string (e.g. "P30DT10H")
IllegalArgumentException
- if the duration string is invalidpublic boolean isPrior()
public Integer getWeeks()
public Integer getDays()
public Integer getHours()
public Integer getMinutes()
public Integer getSeconds()
public boolean hasTime()
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |