Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.xml.schema
Class Time

    java.lang.Object
      |
      +--com.bea.p13n.xml.schema.Time

public class Time
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

This class provides the Java binding for the XML schema type time as specified in Section 3.2.25 of XML Schema Part 2: Datatypes.

time represents a specific instant of a time that recurs every day.

Example: `09:00:00.0005`.

Instances of this type can be constructed from valid instances of time strings and java.sql.Time.

See Also:
  Serialized Form

Field Summary
`protected RecurringDuration` | `_internal`

Constructor Summary
`protected` | `Time()` Constructs a new Time instance.

Method Summary
`java.lang.Object` | `clone()` Returns a copy of this Time.
`int` | `compareTo(java.lang.Object anotherObject)` Compares this Time with another object.
`int` | `compareTo(Time anotherTime)` Compares this Time to another Time object (represented in the same time zone) in their canonical representation.
`static Time` | `createTime()` Returns a Time instance for the current time at the local time zone.
`static Time` | `createTime(java.util.Date date)` Given a java.util.Date, returns a Time instance.
`static Time` | `createTime(java.sql.Date date)` Given a java.sql.Date, returns a Time instance.
`static Time` | `createTime(double time)` Given the value of milliseconds since the 00:00:00 GMT, returns a Time.
`static Time` | `createTime(java.lang.String time)` Given a string of the form hh:mm:ss.sss, returns a Time instance.
`static Time` | `createTime(java.sql.Timestamp timestamp)` Given a java.util.Timestamp, returns a Time instance.
`int` | `getHour()` Returns the hour (hh) field
`int` | `getMinute()` Returns the minute (mm) field
`double` | `getSecond()` Returns the second (ss.sss) field
`double` | `getTime()` Returns the value of milliseconds since 00:00:00 GMT represented by this time instant object.
`java.util.TimeZone` | `getTimeZone()` Returns the time zone
`boolean` | `isTimeZoneUTC()` Returns true if the time instant is based on UTC
`void` | `setHour(int hour)` Sets the hour (hh) field
`void` | `setMinute(int minute)` Sets the minute (mm) field
`void` | `setSecond(double second)` Sets the second (ss.sss) field
`void` | `setTimeZone(int zoneHour, int zoneMinute)` Sets the time zone
`void` | `setTimeZone(java.util.TimeZone timeZone)` Sets the time zone
`java.sql.Time` | `toSQLTime()` Returns a `java.sql.Date` equivalent.
`java.lang.String` | `toString()` Returns a XML schema compliant time string.
`Time` | `toUTC()` Offsets the current time instant to UTC.

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### _internal

    protected RecurringDuration _internal

Constructor Detail

### Time

    protected Time()

  Constructs a new Time instance.

Method Detail

### createTime

    public static Time createTime()

  Returns a Time instance for the current time at the local time zone.

  Returns:
    instance of Time

### createTime

    public static Time createTime(java.lang.String time)
                           throws java.text.ParseException

  Given a string of the form hh:mm:ss.sss, returns a Time instance.

  The argument may optionally contain the time zone.

  Parameters:
    `String` - representation of XML schema time
  Returns:
    instance of Time
  Throws:
    java.text.ParseException - thrown due to illegal string argument

### createTime

    public static Time createTime(java.util.Date date)

  Given a java.util.Date, returns a Time instance.

  Parameters:
    `date` - date
  Returns:
    instance of Time

### createTime

    public static Time createTime(java.sql.Date date)

  Given a java.sql.Date, returns a Time instance.

  Parameters:
    `date` - date
  Returns:
    instance of Time

### createTime

    public static Time createTime(java.sql.Timestamp timestamp)

  Given a java.util.Timestamp, returns a Time instance.

  Parameters:
    `timestamp` - timestamp
  Returns:
    instance of Time

### createTime

    public static Time createTime(double time)

  Given the value of milliseconds since the 00:00:00 GMT, returns a Time.

  Parameters:
    `time` - value of milliseconds since 00:00:00 GMT
  Returns:
    instance of Time

### clone

    public java.lang.Object clone()

  Returns a copy of this Time.

  Returns:
    copy
  Overrides:
    clone in class java.lang.Object

### compareTo

    public int compareTo(Time anotherTime)

  Compares this Time to another Time object (represented in the same time zone) in their canonical representation. Two time instances are considered to be equal if individual fields of the representation (hh:mm:ss.ssshh:ss>) are equal.

  Parameters:
    `anotherTime` - another Time object to be compared.
  Returns:
    the value 0 if the argument Time is equal to this Time; a value less than 0 if this Time is before the Time argument; and a value greater than 0 if this Time is after the Time argument.
  Throws:
    java.lang.IllegalArgumentException - thrown when the argument is represented in a different time zone from the current time instant.

### compareTo

    public int compareTo(java.lang.Object anotherObject)

  Compares this Time with another object. If the other object is a Time, this method behaves like compareTo(Time). Otherwise, it throws a ClassCastException.
  Specified by:
    compareTo in interface java.lang.Comparable

  Parameters:
    `object` - the object to be compared
  Returns:
    the value 0 if the argument Time is equal to this Time; a value less than 0 if this Time is before the Time argument; and a value greater than 0 if this Time is after the Time argument.
  Throws:
    java.lang.ClassCastException - thrown if the argument is not an instance of Time.

### getHour

    public int getHour()

  Returns the hour (hh) field

  Returns:
    the hour

### setHour

    public void setHour(int hour)
                 throws java.lang.IllegalArgumentException

  Sets the hour (hh) field

  Parameters:
    `hour` - the hour
  Throws:
    java.lang.IllegalArgumentException - thrown when the hour argument is illegal

### getMinute

    public int getMinute()

  Returns the minute (mm) field

  Returns:
    the minute

### setMinute

    public void setMinute(int minute)
                   throws java.lang.IllegalArgumentException

  Sets the minute (mm) field

  Parameters:
    `minute` - the minute
  Throws:
    java.lang.IllegalArgumentException - thrown when the minute argument is illegal

### getSecond

    public double getSecond()

  Returns the second (ss.sss) field

  Returns:
    the integer part of second

### setSecond

    public void setSecond(double second)
                   throws java.lang.IllegalArgumentException

  Sets the second (ss.sss) field

  Parameters:
    `second` - the second
  Throws:
    java.lang.IllegalArgumentException - thrown when the second argument is illegal

### setTimeZone

    public void setTimeZone(int zoneHour,
                            int zoneMinute)

  Sets the time zone

  Parameters:
    `zoneHour` - the hour field of timeZone. Can be negative to indicate negative offset.
    `zoneMinute` - the minute field of timeZone

### setTimeZone

    public void setTimeZone(java.util.TimeZone timeZone)

  Sets the time zone

  Parameters:
    `timeZone` - an instance java.util.TimeZone

### getTimeZone

    public java.util.TimeZone getTimeZone()

  Returns the time zone

  Returns:
    timeZone the time zone

### isTimeZoneUTC

    public boolean isTimeZoneUTC()

  Returns true if the time instant is based on UTC

  Returns:
    true if the time instant is based on UTC

### toString

    public java.lang.String toString()

  Returns a XML schema compliant time string.

  The method does not guarantee Time.createTime(_string).toString().equals(_string) to be true.

  Returns:
    string value
  Overrides:
    toString in class java.lang.Object

### getTime

    public double getTime()

  Returns the value of milliseconds since 00:00:00 GMT represented by this time instant object.

  Returns:
    value of milliseconds

### toUTC

    public Time toUTC()

  Offsets the current time instant to UTC.

  Returns:
    instance of TimeInstant offset to UTC

### toSQLTime

    public java.sql.Time toSQLTime()

  Returns a `java.sql.Date` equivalent. Note that this operation excludes any timezone.

  Returns:
    java.sql.Date

Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 BEA Systems, Inc. All Rights Reserved