8021787: javax.xml.datatype.XMLGregorianCalendar.getMonth() return is documented wrong

Reviewed-by: joehw, rriggs
This commit is contained in:
Svetlana Nikandrova 2016-07-27 18:23:04 +03:00
parent 85c169d7cb
commit bcf71c8eff

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -466,13 +466,13 @@ public abstract class XMLGregorianCalendar
} }
/** /**
* Return high order component for XML Schema 1.0 dateTime datatype field for * Returns the high order component for XML Schema 1.0 dateTime datatype field for
* {@code year}. * {@code year}.
* {@code null} if this optional part of the year field is not defined. * {@code null} if this optional part of the year field is not defined.
* *
* <p>Value constraints for this value are summarized in * <p>Value constraints for this value are summarized in
* <a href="#datetimefield-year">year field of date/time field mapping table</a>. * <a href="#datetimefield-year">year field of date/time field mapping table</a>.
* @return eon of this {@code XMLGregorianCalendar}. The value * @return The eon of this {@code XMLGregorianCalendar}. The value
* returned is an integer multiple of 10^9. * returned is an integer multiple of 10^9.
* *
* @see #getYear() * @see #getYear()
@ -481,13 +481,13 @@ public abstract class XMLGregorianCalendar
public abstract BigInteger getEon(); public abstract BigInteger getEon();
/** /**
* Return low order component for XML Schema 1.0 dateTime datatype field for * Returns the low order component for XML Schema 1.0 dateTime datatype field for
* {@code year} or {@link DatatypeConstants#FIELD_UNDEFINED}. * {@code year} or {@link DatatypeConstants#FIELD_UNDEFINED}.
* *
* <p>Value constraints for this value are summarized in * <p>Value constraints for this value are summarized in
* <a href="#datetimefield-year">year field of date/time field mapping table</a>. * <a href="#datetimefield-year">year field of date/time field mapping table</a>.
* *
* @return year of this {@code XMLGregorianCalendar}. * @return The year of this {@code XMLGregorianCalendar}.
* *
* @see #getEon() * @see #getEon()
* @see #getEonAndYear() * @see #getEonAndYear()
@ -495,7 +495,7 @@ public abstract class XMLGregorianCalendar
public abstract int getYear(); public abstract int getYear();
/** /**
* Return XML Schema 1.0 dateTime datatype field for * Returns the XML Schema 1.0 dateTime datatype field for
* {@code year}. * {@code year}.
* *
* <p>Value constraints for this value are summarized in * <p>Value constraints for this value are summarized in
@ -512,61 +512,70 @@ public abstract class XMLGregorianCalendar
public abstract BigInteger getEonAndYear(); public abstract BigInteger getEonAndYear();
/** /**
* Return number of month or {@link DatatypeConstants#FIELD_UNDEFINED}. * Returns the month of this calendar or {@link DatatypeConstants#FIELD_UNDEFINED}.
* *
* <p>Value constraints for this value are summarized in * <p>Value constraints for this value are summarized in
* <a href="#datetimefield-month">month field of date/time field mapping table</a>. * <a href="#datetimefield-month">month field of date/time field mapping table</a>.
* *
* @return year of this {@code XMLGregorianCalendar}. * @return The month of this {@code XMLGregorianCalendar}, from 1 to 12.
* *
*/ */
public abstract int getMonth(); public abstract int getMonth();
/** /**
* Return day in month or {@link DatatypeConstants#FIELD_UNDEFINED}. * Returns the day of month or {@link DatatypeConstants#FIELD_UNDEFINED}.
* *
* <p>Value constraints for this value are summarized in * <p>Value constraints for this value are summarized in
* <a href="#datetimefield-day">day field of date/time field mapping table</a>. * <a href="#datetimefield-day">day field of date/time field mapping table</a>.
* *
* @return The day of month of this {@code XMLGregorianCalendar}, from 1 to 31.
*
* @see #setDay(int) * @see #setDay(int)
*/ */
public abstract int getDay(); public abstract int getDay();
/** /**
* Return timezone offset in minutes or * Returns the Timezone offset in minutes or
* {@link DatatypeConstants#FIELD_UNDEFINED} if this optional field is not defined. * {@link DatatypeConstants#FIELD_UNDEFINED} if this optional field is not defined.
* *
* <p>Value constraints for this value are summarized in * <p>Value constraints for this value are summarized in
* <a href="#datetimefield-timezone">timezone field of date/time field mapping table</a>. * <a href="#datetimefield-timezone">timezone field of date/time field mapping table</a>.
* *
* @return The Timezone offset in minutes of this {@code XMLGregorianCalendar}.
*
* @see #setTimezone(int) * @see #setTimezone(int)
*/ */
public abstract int getTimezone(); public abstract int getTimezone();
/** /**
* Return hours or {@link DatatypeConstants#FIELD_UNDEFINED}. * Returns the hour of day or
* Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined. * {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
* *
* <p>Value constraints for this value are summarized in * <p>Value constraints for this value are summarized in
* <a href="#datetimefield-hour">hour field of date/time field mapping table</a>. * <a href="#datetimefield-hour">hour field of date/time field mapping table</a>.
*
* @return The hour of day of this {@code XMLGregorianCalendar}, from 0 to 23.
*
* @see #setTime(int, int, int) * @see #setTime(int, int, int)
*/ */
public abstract int getHour(); public abstract int getHour();
/** /**
* Return minutes or {@link DatatypeConstants#FIELD_UNDEFINED}. * Returns the minute of hour or
* Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined. * {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
* *
* <p>Value constraints for this value are summarized in * <p>Value constraints for this value are summarized in
* <a href="#datetimefield-minute">minute field of date/time field mapping table</a>. * <a href="#datetimefield-minute">minute field of date/time field mapping table</a>.
*
* @return The minute of hour of this {@code XMLGregorianCalendar}, from 0 to 59.
*
* @see #setTime(int, int, int) * @see #setTime(int, int, int)
*/ */
public abstract int getMinute(); public abstract int getMinute();
/** /**
* Return seconds or {@link DatatypeConstants#FIELD_UNDEFINED}. * Returns the second of minute or
* * {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
* <p>Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
* When this field is not defined, the optional xs:dateTime * When this field is not defined, the optional xs:dateTime
* fractional seconds field, represented by * fractional seconds field, represented by
* {@link #getFractionalSecond()} and {@link #getMillisecond()}, * {@link #getFractionalSecond()} and {@link #getMillisecond()},
@ -575,7 +584,7 @@ public abstract class XMLGregorianCalendar
* <p>Value constraints for this value are summarized in * <p>Value constraints for this value are summarized in
* <a href="#datetimefield-second">second field of date/time field mapping table</a>. * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
* *
* @return Second of this {@code XMLGregorianCalendar}. * @return The second of minute of this {@code XMLGregorianCalendar}, from 0 to 59.
* *
* @see #getFractionalSecond() * @see #getFractionalSecond()
* @see #getMillisecond() * @see #getMillisecond()
@ -584,7 +593,7 @@ public abstract class XMLGregorianCalendar
public abstract int getSecond(); public abstract int getSecond();
/** /**
* Return millisecond precision of {@link #getFractionalSecond()}. * Returns the millisecond precision of {@link #getFractionalSecond()}.
* *
* <p>This method represents a convenience accessor to infinite * <p>This method represents a convenience accessor to infinite
* precision fractional second value returned by * precision fractional second value returned by
@ -597,7 +606,7 @@ public abstract class XMLGregorianCalendar
* <p>Value constraints for this value are summarized in * <p>Value constraints for this value are summarized in
* <a href="#datetimefield-second">second field of date/time field mapping table</a>. * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
* *
* @return Millisecond of this {@code XMLGregorianCalendar}. * @return The millisecond precision of this {@code XMLGregorianCalendar}.
* *
* @see #getFractionalSecond() * @see #getFractionalSecond()
* @see #setTime(int, int, int) * @see #setTime(int, int, int)
@ -615,7 +624,7 @@ public abstract class XMLGregorianCalendar
} }
/** /**
* Return fractional seconds. * Returns fractional seconds.
* *
* <p>{@code null} is returned when this optional field is not defined. * <p>{@code null} is returned when this optional field is not defined.
* *
@ -626,7 +635,7 @@ public abstract class XMLGregorianCalendar
* xs:dateTime second field, represented by {@link #getSecond()}, * xs:dateTime second field, represented by {@link #getSecond()},
* does not return {@link DatatypeConstants#FIELD_UNDEFINED}. * does not return {@link DatatypeConstants#FIELD_UNDEFINED}.
* *
* @return fractional seconds of this {@code XMLGregorianCalendar}. * @return Fractional seconds of this {@code XMLGregorianCalendar}.
* *
* @see #getSecond() * @see #getSecond()
* @see #setTime(int, int, int, BigDecimal) * @see #setTime(int, int, int, BigDecimal)
@ -681,6 +690,7 @@ public abstract class XMLGregorianCalendar
* returns {@link DatatypeConstants#EQUAL}, * returns {@link DatatypeConstants#EQUAL},
* otherwise {@code false}. * otherwise {@code false}.
*/ */
@Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || !(obj instanceof XMLGregorianCalendar)) { if (obj == null || !(obj instanceof XMLGregorianCalendar)) {
@ -694,6 +704,7 @@ public abstract class XMLGregorianCalendar
* *
* @return hash code of this object. * @return hash code of this object.
*/ */
@Override
public int hashCode() { public int hashCode() {
// Following two dates compare to EQUALS since in different timezones. // Following two dates compare to EQUALS since in different timezones.
@ -858,6 +869,7 @@ public abstract class XMLGregorianCalendar
* *
* @see #toXMLFormat() * @see #toXMLFormat()
*/ */
@Override
public String toString() { public String toString() {
return toXMLFormat(); return toXMLFormat();
@ -970,6 +982,8 @@ public abstract class XMLGregorianCalendar
* {@code Calendar.set(int,int)}</li> * {@code Calendar.set(int,int)}</li>
* </ul> * </ul>
* *
* @return An instance of {@link java.util.GregorianCalendar}.
*
* @see #toGregorianCalendar(java.util.TimeZone, java.util.Locale, XMLGregorianCalendar) * @see #toGregorianCalendar(java.util.TimeZone, java.util.Locale, XMLGregorianCalendar)
*/ */
public abstract GregorianCalendar toGregorianCalendar(); public abstract GregorianCalendar toGregorianCalendar();
@ -1055,5 +1069,7 @@ public abstract class XMLGregorianCalendar
* *
* @return copy of this {@code Object} * @return copy of this {@code Object}
*/ */
@Override
public abstract Object clone(); public abstract Object clone();
} }