# com.bea.xml
GDurationSpecification Interface

public interface GDurationSpecification

Represents an XML Schema-compatible duration.

Both the immutable GDuration and the mutable GDurationBuilder are GDurationSpecifications. Use this interface where you want to allow callers to pass any implementation of a GDuration.

Related Topics

``GDuration``

All Known Implementing Classes
  `GDurationBuilder`, `GDuration`

## Method Summary

`public int` | `compareToGDuration`(`GDurationSpecification` duration) Comparison to another GDuration.
`public int` | `getDay`() Gets the day-of-month component.
`public `BigDecimal`` | `getFraction`() Gets the fraction-of-second.
`public int` | `getHour`() Gets the hour-of-day component.
`public int` | `getMinute`() Gets the minute-of-hour component.
`public int` | `getMonth`() Gets the month-of-year component.
`public int` | `getSecond`() Gets the second-of-minute component.
`public int` | `getSign`() Returns the sign of the duration: +1 is forwards and -1 is backwards in time.
`public int` | `getYear`() Gets the year component.
`public boolean` | `isImmutable`() True if this instance is immutable.
`public boolean` | `isValid`() Returns true if all of the individual components of the duration are nonnegative.

## Method Detail

### compareToGDuration(GDurationSpecification) Method

    public int compareToGDuration(GDurationSpecification duration)

Comparison to another GDuration.

- Returns -1 if this < date. (less-than)
- Returns 0 if this == date. (equal)
- Returns 1 if this > date. (greater-than)
- Returns 2 if this <> date. (incomparable)

Two instances are incomparable if they have different amounts of information.

### getDay() Method

    public int getDay()

Gets the day-of-month component.

### getFraction() Method

    public BigDecimal getFraction()

Gets the fraction-of-second. Range from 0 (inclusive) to 1 (exclusive).

### getHour() Method

    public int getHour()

Gets the hour-of-day component.

### getMinute() Method

    public int getMinute()

Gets the minute-of-hour component.

### getMonth() Method

    public int getMonth()

Gets the month-of-year component.

### getSecond() Method

    public int getSecond()

Gets the second-of-minute component.

### getSign() Method

    public int getSign()

Returns the sign of the duration: +1 is forwards and -1 is backwards in time.

### getYear() Method

    public int getYear()

Gets the year component.

### isImmutable() Method

    public boolean isImmutable()

True if this instance is immutable.

### isValid() Method

    public boolean isValid()

Returns true if all of the individual components of the duration are nonnegative.