286N/A/*
286N/A * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
286N/A *
286N/A * This code is free software; you can redistribute it and/or modify it
286N/A * under the terms of the GNU General Public License version 2 only, as
286N/A * published by the Free Software Foundation. Oracle designates this
286N/A * particular file as subject to the "Classpath" exception as provided
286N/A * by Oracle in the LICENSE file that accompanied this code.
286N/A *
286N/A * This code is distributed in the hope that it will be useful, but WITHOUT
286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
286N/A * version 2 for more details (a copy is included in the LICENSE file that
286N/A * accompanied this code).
286N/A *
286N/A * You should have received a copy of the GNU General Public License version
286N/A * 2 along with this work; if not, write to the Free Software Foundation,
286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
286N/A *
286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
286N/A * or visit www.oracle.com if you need additional information or have any
286N/A * questions.
286N/A */
286N/A
286N/Apackage javax.xml.datatype;
286N/A
286N/Aimport javax.xml.XMLConstants;
286N/Aimport javax.xml.namespace.QName;
286N/A
286N/A/**
286N/A * <p>Utility class to contain basic Datatype values as constants.</p>
286N/A *
286N/A * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
286N/A * @since 1.5
286N/A */
286N/A
286N/Apublic final class DatatypeConstants {
286N/A
286N/A /**
286N/A * <p>Private constructor to prevent instantiation.</p>
286N/A */
286N/A private DatatypeConstants() {
286N/A }
286N/A
286N/A /**
286N/A * Value for first month of year.
286N/A */
286N/A public static final int JANUARY = 1;
286N/A
286N/A /**
286N/A * Value for second month of year.
286N/A */
286N/A public static final int FEBRUARY = 2;
286N/A
286N/A /**
286N/A * Value for third month of year.
286N/A */
286N/A public static final int MARCH = 3;
286N/A
286N/A /**
286N/A * Value for fourth month of year.
286N/A */
286N/A public static final int APRIL = 4;
286N/A
286N/A /**
286N/A * Value for fifth month of year.
286N/A */
286N/A public static final int MAY = 5;
286N/A
286N/A /**
286N/A * Value for sixth month of year.
286N/A */
286N/A public static final int JUNE = 6;
286N/A
286N/A /**
286N/A * Value for seventh month of year.
286N/A */
286N/A public static final int JULY = 7;
286N/A
286N/A /**
286N/A * Value for eighth month of year.
286N/A */
286N/A public static final int AUGUST = 8;
286N/A
286N/A /**
286N/A * Value for ninth month of year.
286N/A */
286N/A public static final int SEPTEMBER = 9;
286N/A
286N/A /**
286N/A * Value for tenth month of year.
286N/A */
286N/A public static final int OCTOBER = 10;
286N/A
286N/A /**
286N/A * Value for eleven month of year.
286N/A */
286N/A public static final int NOVEMBER = 11;
286N/A
286N/A /**
286N/A * Value for twelve month of year.
286N/A */
286N/A public static final int DECEMBER = 12;
286N/A
286N/A /**
286N/A * <p>Comparison result.</p>
286N/A */
286N/A public static final int LESSER = -1;
286N/A
286N/A /**
286N/A * <p>Comparison result.</p>
286N/A */
286N/A public static final int EQUAL = 0;
286N/A
286N/A /**
286N/A * <p>Comparison result.</p>
286N/A */
286N/A public static final int GREATER = 1;
286N/A
286N/A /**
286N/A * <p>Comparison result.</p>
286N/A */
286N/A public static final int INDETERMINATE = 2;
286N/A
286N/A /**
286N/A * Designation that an "int" field is not set.
286N/A */
286N/A public static final int FIELD_UNDEFINED = Integer.MIN_VALUE;
286N/A
286N/A /**
286N/A * <p>A constant that represents the years field.</p>
286N/A */
286N/A public static final Field YEARS = new Field("YEARS", 0);
286N/A
286N/A /**
286N/A * <p>A constant that represents the months field.</p>
286N/A */
286N/A public static final Field MONTHS = new Field("MONTHS", 1);
286N/A
286N/A /**
286N/A * <p>A constant that represents the days field.</p>
286N/A */
286N/A public static final Field DAYS = new Field("DAYS", 2);
286N/A
286N/A /**
286N/A * <p>A constant that represents the hours field.</p>
286N/A */
286N/A public static final Field HOURS = new Field("HOURS", 3);
286N/A
286N/A /**
286N/A * <p>A constant that represents the minutes field.</p>
286N/A */
286N/A public static final Field MINUTES = new Field("MINUTES", 4);
286N/A
286N/A /**
286N/A * <p>A constant that represents the seconds field.</p>
286N/A */
286N/A public static final Field SECONDS = new Field("SECONDS", 5);
286N/A
286N/A /**
286N/A * Type-safe enum class that represents six fields
286N/A * of the {@link Duration} class.
286N/A * @since 1.5
286N/A */
286N/A public static final class Field {
286N/A
286N/A /**
286N/A * <p><code>String</code> representation of <code>Field</code>.</p>
286N/A */
286N/A private final String str;
286N/A /**
286N/A * <p>Unique id of the field.</p>
286N/A *
286N/A * <p>This value allows the {@link Duration} class to use switch
286N/A * statements to process fields.</p>
286N/A */
286N/A private final int id;
286N/A
286N/A /**
286N/A * <p>Construct a <code>Field</code> with specified values.</p>
286N/A * @param str <code>String</code> representation of <code>Field</code>
286N/A * @param id <code>int</code> representation of <code>Field</code>
286N/A */
286N/A private Field(final String str, final int id) {
286N/A this.str = str;
286N/A this.id = id;
286N/A }
286N/A /**
286N/A * Returns a field name in English. This method
286N/A * is intended to be used for debugging/diagnosis
286N/A * and not for display to end-users.
286N/A *
286N/A * @return
286N/A * a non-null valid String constant.
286N/A */
286N/A public String toString() { return str; }
286N/A
286N/A /**
286N/A * <p>Get id of this Field.</p>
286N/A *
286N/A * @return Id of field.
286N/A */
286N/A public int getId() {
286N/A return id;
286N/A }
286N/A }
286N/A
286N/A /**
286N/A * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>dateTime</code>.</p>
286N/A */
286N/A public static final QName DATETIME = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "dateTime");
286N/A
286N/A /**
286N/A * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>time</code>.</p>
286N/A */
286N/A public static final QName TIME = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "time");
286N/A
286N/A /**
286N/A * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>date</code>.</p>
286N/A */
286N/A public static final QName DATE = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "date");
286N/A
286N/A /**
286N/A * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gYearMonth</code>.</p>
286N/A */
286N/A public static final QName GYEARMONTH = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gYearMonth");
286N/A
286N/A /**
286N/A * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gMonthDay</code>.</p>
286N/A */
286N/A public static final QName GMONTHDAY = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gMonthDay");
286N/A
286N/A /**
286N/A * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gYear</code>.</p>
286N/A */
286N/A public static final QName GYEAR = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gYear");
286N/A
286N/A /**
286N/A * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gMonth</code>.</p>
286N/A */
286N/A public static final QName GMONTH = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gMonth");
286N/A
286N/A /**
286N/A * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gDay</code>.</p>
286N/A */
286N/A public static final QName GDAY = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gDay");
286N/A
286N/A /**
286N/A * <p>Fully qualified name for W3C XML Schema datatype <code>duration</code>.</p>
286N/A */
286N/A public static final QName DURATION = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "duration");
286N/A
286N/A /**
286N/A * <p>Fully qualified name for XQuery 1.0 and XPath 2.0 datatype <code>dayTimeDuration</code>.</p>
286N/A */
286N/A public static final QName DURATION_DAYTIME = new QName(XMLConstants.W3C_XPATH_DATATYPE_NS_URI, "dayTimeDuration");
286N/A
286N/A /**
286N/A * <p>Fully qualified name for XQuery 1.0 and XPath 2.0 datatype <code>yearMonthDuration</code>.</p>
286N/A */
286N/A public static final QName DURATION_YEARMONTH = new QName(XMLConstants.W3C_XPATH_DATATYPE_NS_URI, "yearMonthDuration");
286N/A
286N/A /**
286N/A * W3C XML Schema max timezone offset is -14:00. Zone offset is in minutes.
286N/A */
286N/A public static final int MAX_TIMEZONE_OFFSET = -14 * 60;
286N/A
286N/A /**
286N/A * W3C XML Schema min timezone offset is +14:00. Zone offset is in minutes.
286N/A */
286N/A public static final int MIN_TIMEZONE_OFFSET = 14 * 60;
286N/A
286N/A}