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 Month

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

Direct Known Subclasses:
  Date

public class Month
extends Year
implements java.io.Serializable, java.lang.Cloneable, java.lang.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

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, java.util.TimeZone timeZone)` Constructs a new Month for the given year, month and timezone.

Method Summary
`java.lang.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(java.lang.Object anotherObject)` Compares this TimePeriod with another object.
`static Month` | `createMonth()` Returns a Month instance for the current month.
`static Month` | `createMonth(java.lang.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
`java.lang.String` | `toString()` Returns a XML schema compliant date string.
`java.lang.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,
                    java.util.TimeZone timeZone)

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

  Parameters:
    `year` - the year (CCYY) field
    `month` - the month (MM) field
    `timezone` - the timezone. May be null if local.

Method Detail

### createMonth

    public static Month createMonth()

  Returns a Month instance for the current month.

  Returns:
    instance of Month

### createMonth

    public static Month createMonth(java.lang.String month)
                             throws java.text.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:
    java.text.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 java.lang.IllegalArgumentException

  Sets the month (MM) field

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

### toUTC

    public java.lang.Object toUTC()

  Offsets the current month instant to UTC.

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

### clone

    public java.lang.Object clone()

  Returns a copy of this Month.

  Returns:
    copy
  Overrides:
    clone in class Year

### 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:
    java.lang.IllegalArgumentException - thrown when the argument is represented in a different time zone from the current month.

### compareTo

    public int compareTo(java.lang.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 java.lang.Comparable

  Parameters:
    `object` - the 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:
    java.lang.ClassCastException - thrown if the argument is not an instance of TimePeriod.
  Overrides:
    compareTo in class Year

### toString

    public java.lang.String toString()

  Returns a XML schema compliant date string.

  Returns:
    string value
  Overrides:
    toString in class Year

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