org.apache.axis.types
Class Duration
java.lang.Object
org.apache.axis.types.Duration
- java.io.Serializable
public class Duration
extends java.lang.Object
implements java.io.Serializable
Implementation of the XML Schema type duration. Duration supports a minimum
fractional second precision of milliseconds.
- Wes Moulder
- Dominik Kacprzak (dominik@opentoolbox.com)
Duration() - Default no-arg constructor
|
Duration(String duration) - Constructs Duration from a String in an xsd:duration format -
PnYnMnDTnHnMnS.
|
Duration(boolean negative, Calendar calendar) - Constructs Duration from a Calendar.
|
Duration(boolean negative, int aYears, int aMonths, int aDays, int aHours, int aMinutes, double aSeconds)
|
Duration
public Duration()
Default no-arg constructor
Duration
public Duration(String duration)
throws IllegalArgumentException
Constructs Duration from a String in an xsd:duration format -
PnYnMnDTnHnMnS.
Duration
public Duration(boolean negative,
Calendar calendar)
throws IllegalArgumentException
Constructs Duration from a Calendar.
Duration
public Duration(boolean negative,
int aYears,
int aMonths,
int aDays,
int aHours,
int aMinutes,
double aSeconds)
negative
- aYears
- aMonths
- aDays
- aHours
- aMinutes
- aSeconds
-
equals
public boolean equals(Object object)
The equals method compares the time represented by duration object, not
its string representation.
Hence, a duration object representing 65 minutes is considered equal to a
duration object representing 1 hour and 5 minutes.
getAsCalendar
public Calendar getAsCalendar()
Returns duration as a calendar. Due to the way a Calendar class works,
the values for particular fields may not be the same as obtained through
getter methods. For example, if a duration's object getMonths
returns 20, a similar call on a calendar object will return 1 year and
8 months.
getAsCalendar
public Calendar getAsCalendar(Calendar startTime)
Returns duration as a calendar. Due to the way a Calendar class works,
the values for particular fields may not be the same as obtained through
getter methods. For example, if a Duration's object getMonths
returns 20, a similar call on a Calendar object will return 1 year and
8 months.
getDays
public int getDays()
getHours
public int getHours()
getMinutes
public int getMinutes()
getMonths
public int getMonths()
getSeconds
public double getSeconds()
getYears
public int getYears()
hashCode
public int hashCode()
isNegative
public boolean isNegative()
parseDate
public void parseDate(String date)
throws IllegalArgumentException
This method parses the date portion of a String that represents
xsd:duration - nYnMnD.
parseTime
public void parseTime(String time)
throws IllegalArgumentException
This method parses the time portion of a String that represents
xsd:duration - nHnMnS.
setDays
public void setDays(int days)
setHours
public void setHours(int hours)
setMinutes
public void setMinutes(int minutes)
setMonths
public void setMonths(int months)
setNegative
public void setNegative(boolean negative)
setSeconds
public void setSeconds(double seconds)
Sets the seconds. NOTE: The fractional value of seconds is rounded up to
milliseconds.
setYears
public void setYears(int years)
toString
public String toString()
This returns the xml representation of an xsd:duration object.
Copyright © 2005 Apache Web Services Project. All Rights Reserved.