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

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

    java.lang.Object
      com.bea.p13n.xml.schema.Time

All Implemented Interfaces:
  Cloneable, Comparable, Serializable

public class Time
extends Object
implements Serializable, Cloneable, 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
`Object` | `clone()` Returns a copy of this Time.
`int` | `compareTo(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(Date date)` Given a java.util.Date, returns a Time instance.
`static Time` | `createTime(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(String time)` Given a string of the form hh:mm:ss.sss, returns a Time instance.
`static Time` | `createTime(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.
`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(TimeZone timeZone)` Sets the time zone
`Time` | `toSQLTime()` Returns a `java.sql.Date` equivalent.
`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

### clone

    public Object clone()

  Returns a copy of this Time.

  Returns:
    copy

### compareTo

    public int compareTo(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 `Comparable`
  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:
    `ClassCastException` - thrown if the argument is not an instance of Time.

### 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.sss hh: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:
    `IllegalArgumentException` - thrown when the argument is represented in a different time zone from the current time instant.

### 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(Date date)

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

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

### createTime

    public static Time createTime(Date date)

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

  Parameters:
    `date` - date
  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

### createTime

    public static Time createTime(String time)
                           throws ParseException

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

  The argument may optionally contain the time zone.

  Returns:
    instance of Time
  Throws:
    `ParseException` - thrown due to illegal string argument

### createTime

    public static Time createTime(Timestamp timestamp)

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

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

### getHour

    public int getHour()

  Returns the hour (hh) field

  Returns:
    the hour

### getMinute

    public int getMinute()

  Returns the minute (mm) field

  Returns:
    the minute

### getSecond

    public double getSecond()

  Returns the second (ss.sss) field

  Returns:
    the integer part of second

### getTime

    public double getTime()

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

  Returns:
    value of milliseconds

### getTimeZone

    public 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

### setHour

    public void setHour(int hour)
                 throws IllegalArgumentException

  Sets the hour (hh) field

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

### setMinute

    public void setMinute(int minute)
                   throws IllegalArgumentException

  Sets the minute (mm) field

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

### setSecond

    public void setSecond(double second)
                   throws IllegalArgumentException

  Sets the second (ss.sss) field

  Parameters:
    `second` - the second
  Throws:
    `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(TimeZone timeZone)

  Sets the time zone

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

### toSQLTime

    public Time toSQLTime()

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

  Returns:
    java.sql.Date

### toString

    public 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

### toUTC

    public Time toUTC()

  Offsets the current time instant to UTC.

  Returns:
    instance of TimeInstant offset to UTC

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

Copyright © 2004 BEA Systems, Inc. All Rights Reserved