com.verisign.epp.types

## Class Duration

- java.lang.Object
- - com.verisign.epp.types.Duration

- All Implemented Interfaces:
    java.io.Serializable

      public class Duration
      extends java.lang.Object
      implements java.io.Serializable

  This class is the representation of XML Schema datatype: duration.

  This representation does not support the decimal fraction for the lowest order item.

  The order relation provided by this implementation does not follow the guidelines of XML Schema Specification that defines only a partial order.

  For more information see X3C XML Schema Specification.

  Version:
    $Revision: 1.1 $ $Date: 2004/01/16 03:44:35 $
  Author:
    Arnaud Blandin
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Duration()` default constructor
    `Duration(long l)` This constructor fills in the duration fields according to the value of the long by calling setValue.
    `Duration(java.lang.String duration)` Constructs a duration from a string

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equal(Duration duration)` Returns true if the instance of TimeDuration has the same fields of the parameter
    `boolean` | `equals(java.lang.Object object)` Override the java.lang.equals method
    `short` | `getDay()`
    `short` | `getHour()`
    `short` | `getMilli()`
    `short` | `getMinute()`
    `short` | `getMonth()`
    `short` | `getSeconds()`
    `short` | `getYear()`
    `int` | `hashCode()` Overrides the java.lang.Object#hashcode method.
    `boolean` | `isGreater(Duration duration)` Returns true if the present instance of TimeDuration is greater than the parameter Note This definition does not follow the XML SCHEMA RECOMMENDATION 05022001 the following total order relation is used : `givent t1,t2 timeDuration types t1>t2 iff t1.toLong()>t2.toLong()`
    `boolean` | `isNegative()`
    `static java.lang.Object` | `parse(java.lang.String str)` parse a String and convert it into a java.lang.Object
    `static Duration` | `parseDuration(java.lang.String str)` Parse the given string and return a time duration which represents this string.
    `void` | `setDay(short day)`
    `void` | `setHour(short hour)`
    `void` | `setMilli(short milli)`
    `void` | `setMinute(short minute)`
    `void` | `setMonth(short month)`
    `void` | `setNegative()`
    `void` | `setSeconds(short second)`
    `void` | `setValue(short year, short month, short day, short hour, short minute, short second, short millisecond)` Fill in the fields of the duration with the given values
    `void` | `setYear(short year)`
    `long` | `toLong()` Convert a duration into a long This long represents the duration in milliseconds.
    `java.lang.String` | `toString()` Convert a duration into a String conforming to ISO8601 and XML Schema specs

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Duration

          public Duration()

      default constructor

    - #### Duration

          public Duration(java.lang.String duration)
                   throws java.text.ParseException

      Constructs a duration from a string
      Parameters:
        `duration` - the string representation of the duration to create
      Throws:
        `java.text.ParseException`

    - #### Duration

          public Duration(long l)

      This constructor fills in the duration fields according to the value of the long by calling setValue.

      Parameters:
        `l` - the long value of the Duration
      See Also:
        `setValue(short, short, short, short, short, short, short)`

  - ### Method Detail

    - #### setYear

          public void setYear(short year)

    - #### setMonth

          public void setMonth(short month)

    - #### setDay

          public void setDay(short day)

    - #### setHour

          public void setHour(short hour)

    - #### setMinute

          public void setMinute(short minute)

    - #### setSeconds

          public void setSeconds(short second)

    - #### setMilli

          public void setMilli(short milli)

    - #### setNegative

          public void setNegative()

    - #### setValue

          public void setValue(short year,
                               short month,
                               short day,
                               short hour,
                               short minute,
                               short second,
                               short millisecond)

      Fill in the fields of the duration with the given values
      Parameters:
        `year` - the year value
        `month` - the month value
        `day` - the day value
        `hour` - the hour value
        `minute` - the minute value
        `second` - the second value

    - #### getYear

          public short getYear()

    - #### getMonth

          public short getMonth()

    - #### getDay

          public short getDay()

    - #### getHour

          public short getHour()

    - #### getMinute

          public short getMinute()

    - #### getSeconds

          public short getSeconds()

    - #### getMilli

          public short getMilli()

    - #### isNegative

          public boolean isNegative()

    - #### toLong

          public long toLong()

      Convert a duration into a long This long represents the duration in milliseconds.

      Returns:
        a long representing the duration

    - #### toString

          public java.lang.String toString()

      Convert a duration into a String conforming to ISO8601 and XML Schema specs

      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string representing the duration

    - #### parse

          public static java.lang.Object parse(java.lang.String str)
                                        throws java.text.ParseException

      parse a String and convert it into a java.lang.Object
      Parameters:
        `str` - the string to parse
      Returns:
        the java.lang.Object represented by the string
      Throws:
        `java.text.ParseException` - a parse exception is thrown if the string to parse does not follow the rigth format (see the description of this class)

    - #### parseDuration

          public static Duration parseDuration(java.lang.String str)
                                        throws java.text.ParseException

      Parse the given string and return a time duration which represents this string.

      Parameters:
        `str` - the string to parse
      Returns:
        a TimeDuration instance which represent the string
      Throws:
        `java.text.ParseException` - thrown when the string is not valid

    - #### hashCode

          public int hashCode()

      Overrides the java.lang.Object#hashcode method.
      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object object)

      Override the java.lang.equals method
      Overrides:
        `equals` in class `java.lang.Object`
      See Also:
        `equal(com.verisign.epp.types.Duration)`

    - #### equal

          public boolean equal(Duration duration)

      Returns true if the instance of TimeDuration has the same fields of the parameter
      Parameters:
        `duration` - the time duration to compare
      Returns:
        true if equal, false if not

    - #### isGreater

          public boolean isGreater(Duration duration)

      Returns true if the present instance of TimeDuration is greater than the parameter

      Note This definition does not follow the XML SCHEMA RECOMMENDATION 05022001 the following total order relation is used : `givent t1,t2 timeDuration types t1>t2 iff t1.toLong()>t2.toLong()`

      Parameters:
        `duration` - the time duration to compare with the present instance
      Returns:
        true if the present instance is the greatest, false if not

Copyright © VeriSign Inc. All Rights Reserved.