Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2003 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 Year

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

All Implemented Interfaces:
  Cloneable, Comparable, Serializable

Direct Known Subclasses:
  Month

public class Year
extends Century
implements Serializable, Cloneable, 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.

The schema type 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 year is the set of Gregorian calendar years specified as CCYY.

Example: `2001`.

See Also:
  Serialized Form

Field Summary

Fields inherited from class com.bea.p13n.xml.schema.Century
`_internal`

Constructor Summary
`protected` | `Year()` Constructs a new Year instance.
`protected` | `Year(long year, TimeZone timeZone)` Constructs a new Year for the given year and timezone.

Method Summary
`Object` | `clone()` Returns a copy of this Year.
`int` | `compareTo(Object anotherObject)` Compares this Year another object.
`int` | `compareTo(Year anotherYear)` Compares this Year to another Year object (represented in the same time zone) in their canonical representation.
`static Year` | `createYear()` Returns a Year instance for the current year.
`static Year` | `createYear(String year)` Given a string of the form CCYY, returns a Year instance.
`long` | `getYear()` Returns the year (CCYY) field
`void` | `setYear(int century, int year)` Sets the year (CCYY) field
`void` | `setYear(long year)` Sets the year (CCYY) field
`String` | `toString()` Returns a XML schema compliant year string.
`Object` | `toUTC()` Offsets the current month instant to UTC.

Methods inherited from class com.bea.p13n.xml.schema.Century
`compareTo, createCentury, createCentury, getCentury, getEra, getTimeZone, setCentury, setEra, setTimeZone, setTimeZone`

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

Constructor Detail

### Year

    protected Year()

  Constructs a new Year instance.

### Year

    protected Year(long year,
                   TimeZone timeZone)

  Constructs a new Year for the given year and timezone. The year argument should include the century.

Parameters:
  `year` - the year (CCYY) field

Method Detail

### createYear

    public static Year createYear()

  Returns a Year instance for the current year.

  Returns:
    instance of Year

### createYear

    public static Year createYear(String year)
                           throws ParseException

  Given a string of the form CCYY, returns a Year instance.

  The argument may optionally include a timezone.

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

### getYear

    public long getYear()

  Returns the year (CCYY) field

  Returns:
    the year

### setYear

    public void setYear(int century,
                        int year)
                 throws IllegalArgumentException

  Sets the year (CCYY) field

  Parameters:
    `century` - the century (CC)
    `year` - the year (YY)
  Throws:
    `IllegalArgumentException` - thrown when the century and year arguments are illegal

### setYear

    public void setYear(long year)

  Sets the year (CCYY) field

### toUTC

    public Object toUTC()

  Offsets the current month instant to UTC.

  Overrides:
    `toUTC` in class `Century`
  Returns:
    instance of Year offset to UTC

### clone

    public Object clone()

  Returns a copy of this Year.

  Overrides:
    `clone` in class `Century`
  Returns:
    copy

### compareTo

    public int compareTo(Year anotherYear)

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

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

### compareTo

    public int compareTo(Object anotherObject)

  Compares this Year another object. If the other object is a Year, this method behaves like compareTo(Year). Otherwise, it throws a ClassCastException.

  Specified by:
    `compareTo` in interface `Comparable`
  Overrides:
    `compareTo` in class `Century`
  Returns:
    the value 0 if the argument Year is equal to this Year; a value less than 0 if this Year is before the Year argument; and a value greater than 0 if this Year is after the Year argument.
  Throws:
    `ClassCastException` - thrown if the argument is not an instance of Year.

### toString

    public String toString()

  Returns a XML schema compliant year string.

  Overrides:
    `toString` in class `Century`
  Returns:
    string value

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

Copyright © 2003 BEA Systems, Inc. All Rights Reserved