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 Century

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

Direct Known Subclasses:
  Year

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

This class provides the Java biding for the XML schema type year as specified in Section 3.3.29 of XML Schema Part 2: Datatypes.

year represents a specific period of time that starts at the midnight that starts of the first day of the year and ends at the midnight that ends the last day of the year.

The value space of century is the set of Gregorian calendar centuries specified as CC.

Example: `21` for 21st century

See Also:
  Serialized Form

Field Summary
`protected TimePeriod` | `_internal`

Constructor Summary
`protected` | `Century()` Constructs a new Century instance.
`protected` | `Century(long century, java.util.TimeZone timeZone)` Constructs a new Century for the given century and timezone.

Method Summary
`java.lang.Object` | `clone()` Returns a copy of this Century.
`int` | `compareTo(Century anotherCentury)` Compares this Century to another Century object (represented in the same time zone) in their canonical representation.
`int` | `compareTo(java.lang.Object anotherObject)` Compares this Century another object.
`static Century` | `createCentury()` Returns a Century instance for the current century.
`static Century` | `createCentury(java.lang.String century)` Given a string of the form CC, returns a Century instance.
`long` | `getCentury()` Returns the year (CC) field
`int` | `getEra()` Returns the era (+/-)
`java.util.TimeZone` | `getTimeZone()` Returns the time zone
`void` | `setCentury(long century)` Sets the year (CCYY) field
`void` | `setEra(int era)` Sets the era (+/-)
`void` | `setTimeZone(int zoneHour, int zoneMinute)` Sets the time zone
`void` | `setTimeZone(java.util.TimeZone timeZone)` Sets the time zone
`java.lang.String` | `toString()` Returns a XML schema compliant year string.
`java.lang.Object` | `toUTC()` Offsets the current century instant to UTC.

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

Field Detail

### _internal

    protected TimePeriod _internal

Constructor Detail

### Century

    protected Century()

  Constructs a new Century instance.

### Century

    protected Century(long century,
                      java.util.TimeZone timeZone)

  Constructs a new Century for the given century and timezone.

  Parameters:
    `century` - the century (CC) field
    `timezone` - the timezone. May be null if local.

Method Detail

### createCentury

    public static Century createCentury()

  Returns a Century instance for the current century.

  Returns:
    instance of Century

### createCentury

    public static Century createCentury(java.lang.String century)
                                 throws java.text.ParseException

  Given a string of the form CC, returns a Century instance.

  The argument may optionally include a timezone.

  Returns:
    instance of Century
  Throws:
    java.text.ParseException - thrown due to illegal string argument.

### getCentury

    public long getCentury()

  Returns the year (CC) field

  Returns:
    the year

### setCentury

    public void setCentury(long century)
                    throws java.lang.IllegalArgumentException

  Sets the year (CCYY) field

  Parameters:
    `century` - the century (CC)
  Throws:
    java.lang.IllegalArgumentException - thrown when the century and year arguments are 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

### getEra

    public int getEra()

  Returns the era (+/-)

  Returns:
    the era (one of java.util.GregorianCalendar.AD or java.util.GregorianCalendar.BC)

### setEra

    public void setEra(int era)

  Sets the era (+/-)

  Parameters:
    `era` - the era (+/-)

### toUTC

    public java.lang.Object toUTC()

  Offsets the current century instant to UTC.

  Returns:
    instance of Century offset to UTC

### clone

    public java.lang.Object clone()

  Returns a copy of this Century.

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

### compareTo

    public int compareTo(Century anotherCentury)

  Compares this Century to another Century object (represented in the same time zone) in their canonical representation.

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

### compareTo

    public int compareTo(java.lang.Object anotherObject)

  Compares this Century another object. If the other object is a Century, this method behaves like compareTo(Century). 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 Century is equal to this Century; a value less than 0 if this Century is before the Century argument; and a value greater than 0 if this Century is after the Century argument.
  Throws:
    java.lang.ClassCastException - thrown if the argument is not an instance of Year.

### toString

    public java.lang.String toString()

  Returns a XML schema compliant year string.

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

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