< prev index next >
src/java.xml/share/classes/javax/xml/datatype/XMLGregorianCalendar.java
Print this page
@@ -1,7 +1,7 @@
/*
- * 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.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -464,40 +464,40 @@
setSecond(second);
setMillisecond(millisecond);
}
/**
- * 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 null} if this optional part of the year field is not defined.
*
* <p>Value constraints for this value are summarized in
* <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.
*
* @see #getYear()
* @see #getEonAndYear()
*/
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}.
*
* <p>Value constraints for this value are summarized in
* <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 #getEonAndYear()
*/
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}.
*
* <p>Value constraints for this value are summarized in
* <a href="#datetimefield-year">year field of date/time field mapping table</a>.
*
@@ -510,83 +510,92 @@
* @see #getYear()
*/
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
* <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();
/**
- * 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
* <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)
*/
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.
*
* <p>Value constraints for this value are summarized in
* <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)
*/
public abstract int getTimezone();
/**
- * Return hours or {@link DatatypeConstants#FIELD_UNDEFINED}.
- * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
+ * Returns the hour of day or
+ * {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
*
* <p>Value constraints for this value are summarized in
* <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)
*/
public abstract int getHour();
/**
- * Return minutes or {@link DatatypeConstants#FIELD_UNDEFINED}.
- * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
+ * Returns the minute of hour or
+ * {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
*
* <p>Value constraints for this value are summarized in
* <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)
*/
public abstract int getMinute();
/**
- * Return seconds or {@link DatatypeConstants#FIELD_UNDEFINED}.
- *
- * <p>Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
+ * Returns the second of minute or
+ * {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
* When this field is not defined, the optional xs:dateTime
* fractional seconds field, represented by
* {@link #getFractionalSecond()} and {@link #getMillisecond()},
* must not be defined.
*
* <p>Value constraints for this value are summarized in
* <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 #getMillisecond()
* @see #setTime(int, int, int)
*/
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
* precision fractional second value returned by
* {@link #getFractionalSecond()}. The returned value is the rounded
* down to milliseconds value of
@@ -595,11 +604,11 @@
* {@link DatatypeConstants#FIELD_UNDEFINED}.
*
* <p>Value constraints for this value are summarized in
* <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 #setTime(int, int, int)
*/
public int getMillisecond() {
@@ -613,11 +622,11 @@
return getFractionalSecond().movePointRight(3).intValue();
}
/**
- * Return fractional seconds.
+ * Returns fractional seconds.
*
* <p>{@code null} is returned when this optional field is not defined.
*
* <p>Value constraints are detailed in
* <a href="#datetimefield-second">second field of date/time field mapping table</a>.
@@ -624,11 +633,11 @@
*
* <p>This optional field can only have a defined value when the
* xs:dateTime second field, represented by {@link #getSecond()},
* does not return {@link DatatypeConstants#FIELD_UNDEFINED}.
*
- * @return fractional seconds of this {@code XMLGregorianCalendar}.
+ * @return Fractional seconds of this {@code XMLGregorianCalendar}.
*
* @see #getSecond()
* @see #setTime(int, int, int, BigDecimal)
*/
public abstract BigDecimal getFractionalSecond();
@@ -679,10 +688,11 @@
* {@code XMLGregorianCalendar} and
* {@link #compare(XMLGregorianCalendar obj)}
* returns {@link DatatypeConstants#EQUAL},
* otherwise {@code false}.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof XMLGregorianCalendar)) {
return false;
}
@@ -692,10 +702,11 @@
/**
* Returns a hash code consistent with the definition of the equals method.
*
* @return hash code of this object.
*/
+ @Override
public int hashCode() {
// Following two dates compare to EQUALS since in different timezones.
// 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00
//
@@ -856,10 +867,11 @@
* @throws IllegalStateException if the combination of set fields
* does not match one of the eight defined XML Schema builtin date/time datatypes.
*
* @see #toXMLFormat()
*/
+ @Override
public String toString() {
return toXMLFormat();
}
@@ -968,10 +980,12 @@
* <li>Its fields ERA, YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY,
* MINUTE, SECOND and MILLISECOND are set using the method
* {@code Calendar.set(int,int)}</li>
* </ul>
*
+ * @return An instance of {@link java.util.GregorianCalendar}.
+ *
* @see #toGregorianCalendar(java.util.TimeZone, java.util.Locale, XMLGregorianCalendar)
*/
public abstract GregorianCalendar toGregorianCalendar();
/**
@@ -1053,7 +1067,9 @@
/**
* Creates and returns a copy of this object.
*
* @return copy of this {@code Object}
*/
+ @Override
public abstract Object clone();
}
+
< prev index next >