< prev index next >

src/java.xml/share/classes/javax/xml/datatype/XMLGregorianCalendar.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2003, 2006, 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 --- 1,7 ---- /* ! * 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,503 **** setSecond(second); setMillisecond(millisecond); } /** ! * Return 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 * 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 * {@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}. * * @see #getEon() * @see #getEonAndYear() */ public abstract int getYear(); /** ! * Return 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>. * --- 464,503 ---- setSecond(second); setMillisecond(millisecond); } /** ! * 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 The eon of this {@code XMLGregorianCalendar}. The value * returned is an integer multiple of 10^9. * * @see #getYear() * @see #getEonAndYear() */ public abstract BigInteger getEon(); /** ! * 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 The year of this {@code XMLGregorianCalendar}. * * @see #getEon() * @see #getEonAndYear() */ public abstract int getYear(); /** ! * 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,592 **** * @see #getYear() */ public abstract BigInteger getEonAndYear(); /** ! * Return number of month 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}. * */ public abstract int getMonth(); /** ! * Return day in 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>. * * @see #setDay(int) */ public abstract int getDay(); /** ! * Return 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>. * * @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. * * <p>Value constraints for this value are summarized in * <a href="#datetimefield-hour">hour field of date/time field mapping table</a>. * @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. * * <p>Value constraints for this value are summarized in * <a href="#datetimefield-minute">minute field of date/time field mapping table</a>. * @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. * 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}. * * @see #getFractionalSecond() * @see #getMillisecond() * @see #setTime(int, int, int) */ public abstract int getSecond(); /** ! * Return 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 --- 510,601 ---- * @see #getYear() */ public abstract BigInteger getEonAndYear(); /** ! * 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 The month of this {@code XMLGregorianCalendar}, from 1 to 12. * */ public abstract int getMonth(); /** ! * 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(); /** ! * 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(); /** ! * 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(); /** ! * 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(); /** ! * 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 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(); /** ! * 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,605 **** * {@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}. * * @see #getFractionalSecond() * @see #setTime(int, int, int) */ public int getMillisecond() { --- 604,614 ---- * {@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 The millisecond precision of this {@code XMLGregorianCalendar}. * * @see #getFractionalSecond() * @see #setTime(int, int, int) */ public int getMillisecond() {
*** 613,623 **** return getFractionalSecond().movePointRight(3).intValue(); } /** ! * Return 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>. --- 622,632 ---- return getFractionalSecond().movePointRight(3).intValue(); } /** ! * 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,634 **** * * <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}. * * @see #getSecond() * @see #setTime(int, int, int, BigDecimal) */ public abstract BigDecimal getFractionalSecond(); --- 633,643 ---- * * <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}. * * @see #getSecond() * @see #setTime(int, int, int, BigDecimal) */ public abstract BigDecimal getFractionalSecond();
*** 679,688 **** --- 688,698 ---- * {@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,701 **** --- 702,712 ---- /** * 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,865 **** --- 867,877 ---- * @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,977 **** --- 980,991 ---- * <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,1059 **** --- 1067,1075 ---- /** * Creates and returns a copy of this object. * * @return copy of this {@code Object} */ + @Override public abstract Object clone(); } +
< prev index next >