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 Month

    java.lang.Object
      com.bea.p13n.xml.schema.Century
          com.bea.p13n.xml.schema.Year
              com.bea.p13n.xml.schema.Month

All Implemented Interfaces:
  Cloneable, Comparable, Serializable

Direct Known Subclasses:
  Date

public class Month
extends Year
implements Serializable, Cloneable, Comparable

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

month represents a specific period of time that starts on the first day of the month and lasts until the midnight that ends the last day of the month.

The value space of month is the set of Gregorian calendar months specified as CCYY-MM. It is a set of one-month long, non-period instances independent of how many days this month has.

Example: `2001-01`.

See Also:
  Serialized Form

Field Summary

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

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

Method Summary
`Object` | `clone()` Returns a copy of this Month.
`int` | `compareTo(Month anotherMonth)` Compares this Month to another Month object (represented in the same time zone) in their canonical representation.
`int` | `compareTo(Object anotherObject)` Compares this TimePeriod with another object.
`static Month` | `createMonth()` Returns a Month instance for the current month.
`static Month` | `createMonth(String month)` Given a string of the form CCYY-MM, returns a Month instance.
`int` | `getMonth()` Returns the month (MM) field
`void` | `setMonth(int month)` Sets the month (MM) field
`String` | `toString()` Returns a XML schema compliant date string.
`Object` | `toUTC()` Offsets the current month instant to UTC.

Methods inherited from class com.bea.p13n.xml.schema.Year
`compareTo, createYear, createYear, getYear, setYear, setYear`

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

### Month

    protected Month()

  Constructs a new Month instance.

### Month

    protected Month(long year,
                    int month,
                    TimeZone timeZone)

  Constructs a new Month for the given year, month and timezone.

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

Method Detail

### createMonth

    public static Month createMonth()

  Returns a Month instance for the current month.

  Returns:
    instance of Month

### createMonth

    public static Month createMonth(String month)
                             throws ParseException

  Given a string of the form CCYY-MM, returns a Month instance.

  The argument may optionally include a timezone.

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

### getMonth

    public int getMonth()

  Returns the month (MM) field

  Returns:
    the month

### setMonth

    public void setMonth(int month)
                  throws IllegalArgumentException

  Sets the month (MM) field

  Parameters:
    `month` - the month (MM)
  Throws:
    `IllegalArgumentException` - thrown when the month argument is illegal

### toUTC

    public Object toUTC()

  Offsets the current month instant to UTC.

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

### clone

    public Object clone()

  Returns a copy of this Month.

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

### compareTo

    public int compareTo(Month anotherMonth)

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

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

### compareTo

    public int compareTo(Object anotherObject)

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

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

### toString

    public String toString()

  Returns a XML schema compliant date string.

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

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