public class Duration extends Object
| Modifier and Type | Class and Description | 
|---|---|
| static class  | Duration.UnitValid units for Duration | 
| Constructor and Description | 
|---|
| Duration()Default constructor
 sets duration to 0 days | 
| Duration(int amount,
        Duration.Unit units)Create from amount and unit | 
| Duration(String value)Create instance from a String 
 Expected format is "%d {Unit}" for example "3 Days" (without the quotes) | 
| Modifier and Type | Method and Description | 
|---|---|
| static boolean | compare(Duration a,
       Duration b)Compare two Duration instances | 
| boolean | equals(Object obj)Compare this instance to another Duration | 
| int | getAmount()return the amount specified by this Duration | 
| int | getDays()Get amount of this Duration in days | 
| Duration.Unit | getUnits()return the units specified by this Duration | 
| int | hashCode()Get the hash code for this instance | 
| static Duration | parse(String value)Create a Duration from a String | 
| String | toString()Convert this instance to it's string representation (%d {Unit}) | 
public Duration()
public Duration(int amount,
                Duration.Unit units)
amount - - amount value for this instanceunits - - unit value for this instancepublic Duration(String value)
value - - string value used to set amount and unitIllegalArgumentException - if thre is an error in parsing the valuepublic int getAmount()
public Duration.Unit getUnits()
public int getDays()
public static boolean compare(Duration a, Duration b)
a - - one instanceb - - the other instancepublic static Duration parse(String value)
value - - string used to createDuration(String)public String toString()
public boolean equals(Object obj)
Copyright © 2015 VersionOne, Inc.. All rights reserved.