Interface GDurationSpecification

All Known Implementing Classes:
GDuration, GDurationBuilder

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.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Comparison to another GDuration.
    int
    Gets the day-of-month component.
    Gets the fraction-of-second.
    int
    Gets the hour-of-day component.
    int
    Gets the minute-of-hour component.
    int
    Gets the month-of-year component.
    int
    Gets the second-of-minute component.
    int
    Returns the sign of the duration: +1 is forwards and -1 is backwards in time.
    int
    Gets the year component.
    boolean
    True if this instance is immutable.
    boolean
    Returns true if all of the individual components of the duration are nonnegative.
  • Method Details

    • isImmutable

      boolean isImmutable()
      True if this instance is immutable.
    • getSign

      int getSign()
      Returns the sign of the duration: +1 is forwards and -1 is backwards in time.
    • getYear

      int getYear()
      Gets the year component.
    • getMonth

      int getMonth()
      Gets the month-of-year component.
    • getDay

      int getDay()
      Gets the day-of-month component.
    • getHour

      int getHour()
      Gets the hour-of-day component.
    • getMinute

      int getMinute()
      Gets the minute-of-hour component.
    • getSecond

      int getSecond()
      Gets the second-of-minute component.
    • getFraction

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

      boolean isValid()
      Returns true if all of the individual components of the duration are nonnegative.
    • compareToGDuration

      int compareToGDuration(GDurationSpecification duration)
      Comparison to another GDuration.
      • Returns -1 if this < duration. (less-than)
      • Returns 0 if this == duration. (equal)
      • Returns 1 if this > duration. (greater-than)
      • Returns 2 if this <> duration. (incomparable)
      Two instances are incomparable if they have different amounts of information.