Joda Time API

org.joda.time.gj
Class GJTimeOnly

java.lang.Object
  |
  +--org.joda.time.AbstractInstant
        |
        +--org.joda.time.TimeOnly
              |
              +--org.joda.time.gj.GJTimeOnly
All Implemented Interfaces:
java.lang.Comparable, ReadableInstant, java.io.Serializable

public final class GJTimeOnly
extends TimeOnly

GJTimeOnly is the basic implementation of a time only class using the GJChronology. It holds the time as milliseconds from the Epoch of 1970-01-01T00:00:00Z. There is no date component - the date is always 1970-01-01.

Author:
Stephen Colebourne, Brian S O'Neill
See Also:
Serialized Form

Constructor Summary
GJTimeOnly()
          Constructs a GJTimeOnly to the current time, as reported by the system clock.
GJTimeOnly(java.util.Calendar calendar)
          Constructs a GJTimeOnly from a Calendar.
GJTimeOnly(java.util.Calendar calendar, DateTimeZone zone)
          Constructs a GJTimeOnly from a Calendar.
GJTimeOnly(java.util.Date date)
          Constructs a GJTimeOnly from a Date.
GJTimeOnly(java.util.Date date, DateTimeZone zone)
          Constructs a GJTimeOnly from a Date.
GJTimeOnly(DateTimeZone zone)
          Constructs a GJTimeOnly to the current time, as reported by the system clock.
GJTimeOnly(long millis)
          Constructs a GJTimeOnly set to the milliseconds from 1970-01-01T00:00:00Z.
GJTimeOnly(long millis, DateTimeZone zone)
          Constructs a GJTimeOnly set to the milliseconds from 1970-01-01T00:00:00Z.
GJTimeOnly(ReadableInstant instant)
          Constructs a GJTimeOnly from a ReadableInstant.
GJTimeOnly(ReadableInstant instant, DateTimeZone zone)
          Constructs a GJTimeOnly from a ReadableInstant.
GJTimeOnly(java.lang.String str)
          Constructs a GJTimeOnly from an ISO formatted String.
GJTimeOnly(java.lang.String str, DateTimeZone zone)
          Constructs a GJTimeOnly from an ISO formatted String.
 
Methods inherited from class org.joda.time.TimeOnly
getChronology, getHourOfDay, getMillis, getMillisOfDay, getMillisOfSecond, getMinuteOfDay, getMinuteOfHour, getSecondOfDay, getSecondOfMinute, hourOfDay, millisOfDay, millisOfSecond, minuteOfDay, minuteOfHour, secondOfDay, secondOfMinute, toString
 
Methods inherited from class org.joda.time.AbstractInstant
compareTo, equals, get, hashCode, isAfter, isBefore, isEqual, toCalendar, toDate, toGregorianCalendar, toInstant
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GJTimeOnly

public GJTimeOnly()
Constructs a GJTimeOnly to the current time, as reported by the system clock. The time zone is set to DateTimeZone.getDefault().


GJTimeOnly

public GJTimeOnly(DateTimeZone zone)
Constructs a GJTimeOnly to the current time, as reported by the system clock. If the supplied time zone is null, it is set to DateTimeZone.getDefault().

Parameters:
zone - the time zone, null is default

GJTimeOnly

public GJTimeOnly(long millis)
Constructs a GJTimeOnly set to the milliseconds from 1970-01-01T00:00:00Z. The time zone is set to DateTimeZone.getDefault().

Parameters:
millis - the milliseconds

GJTimeOnly

public GJTimeOnly(long millis,
                  DateTimeZone zone)
Constructs a GJTimeOnly set to the milliseconds from 1970-01-01T00:00:00Z. If the supplied time zone is null, it is set to DateTimeZone.getDefault().

Parameters:
millis - the milliseconds
zone - the time zone, null is default

GJTimeOnly

public GJTimeOnly(ReadableInstant instant)
Constructs a GJTimeOnly from a ReadableInstant. The time zone is set to DateTimeZone.getDefault().

Parameters:
instant - the ReadableInstant.
Throws:
java.lang.IllegalArgumentException - if the instant is null.

GJTimeOnly

public GJTimeOnly(ReadableInstant instant,
                  DateTimeZone zone)
Constructs a GJTimeOnly from a ReadableInstant. If the supplied time zone is null, it is set to DateTimeZone.getDefault().

Parameters:
instant - the ReadableInstant.
zone - the time zone, null is default
Throws:
java.lang.IllegalArgumentException - if the instant is null.

GJTimeOnly

public GJTimeOnly(java.util.Date date)
Constructs a GJTimeOnly from a Date. The time zone is set to DateTimeZone.getDefault().

Parameters:
date - the Date
Throws:
java.lang.IllegalArgumentException - if the date is null.

GJTimeOnly

public GJTimeOnly(java.util.Date date,
                  DateTimeZone zone)
Constructs a GJTimeOnly from a Date. If the supplied time zone is null, it is set to DateTimeZone.getDefault().

Parameters:
date - the Date
zone - the time zone, null is default
Throws:
java.lang.IllegalArgumentException - if date is null.

GJTimeOnly

public GJTimeOnly(java.util.Calendar calendar)
Constructs a GJTimeOnly from a Calendar. The time zone is set to DateTimeZone.getDefault().

Parameters:
calendar - the Calendar
Throws:
java.lang.IllegalArgumentException - if the calendar is null.

GJTimeOnly

public GJTimeOnly(java.util.Calendar calendar,
                  DateTimeZone zone)
Constructs a GJTimeOnly from a Calendar. If the supplied time zone is null, it is set to DateTimeZone.getDefault().

Parameters:
calendar - the Calendar
zone - the time zone, null is default
Throws:
java.lang.IllegalArgumentException - if the calendar is null.

GJTimeOnly

public GJTimeOnly(java.lang.String str)
           throws java.text.ParseException
Constructs a GJTimeOnly from an ISO formatted String. The time zone is set to DateTimeZone.getDefault().

Parameters:
str - the string to parse.
Throws:
java.lang.IllegalArgumentException - if the string is null.
java.text.ParseException - if parsing fails.

GJTimeOnly

public GJTimeOnly(java.lang.String str,
                  DateTimeZone zone)
           throws java.text.ParseException
Constructs a GJTimeOnly from an ISO formatted String. If the supplied time zone is null, it is set to DateTimeZone.getDefault().

Parameters:
str - the string to parse.
zone - the time zone, null is default
Throws:
java.lang.IllegalArgumentException - if the string is null.
java.text.ParseException - if parsing fails.

Joda Time API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.