2
* Copyright 2003-2004 The Apache Software Foundation.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
// $Id: DatatypeConstants.java 226183 2005-04-08 10:39:14Z neeraj $
19
package javax.xml.datatype;
21
import javax.xml.XMLConstants;
22
import javax.xml.namespace.QName;
25
* <p>Utility class to contain basic Datatype values as constants.</p>
27
* @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
28
* @version $Revision: 226183 $, $Date: 2005-04-08 06:39:14 -0400 (Fri, 08 Apr 2005) $
32
public final class DatatypeConstants {
35
* <p>Private constructor to prevent instantiation.</p>
37
private DatatypeConstants() {
41
* Value for first month of year.
43
public static final int JANUARY = 1;
46
* Value for second month of year.
48
public static final int FEBRUARY = 2;
51
* Value for third month of year.
53
public static final int MARCH = 3;
56
* Value for fourth month of year.
58
public static final int APRIL = 4;
61
* Value for fifth month of year.
63
public static final int MAY = 5;
66
* Value for sixth month of year.
68
public static final int JUNE = 6;
71
* Value for seventh month of year.
73
public static final int JULY = 7;
76
* Value for eighth month of year.
78
public static final int AUGUST = 8;
81
* Value for ninth month of year.
83
public static final int SEPTEMBER = 9;
86
* Value for tenth month of year.
88
public static final int OCTOBER = 10;
91
* Value for eleven month of year.
93
public static final int NOVEMBER = 11;
96
* Value for twelve month of year.
98
public static final int DECEMBER = 12;
101
* <p>Comparison result.</p>
103
public static final int LESSER = -1;
106
* <p>Comparison result.</p>
108
public static final int EQUAL = 0;
111
* <p>Comparison result.</p>
113
public static final int GREATER = 1;
116
* <p>Comparison result.</p>
118
public static final int INDETERMINATE = 2;
121
* Designation that an "int" field is not set.
123
public static final int FIELD_UNDEFINED = Integer.MIN_VALUE;
126
* <p>A constant that represents the years field.</p>
128
public static final Field YEARS = new Field("YEARS", 0);
131
* <p>A constant that represents the months field.</p>
133
public static final Field MONTHS = new Field("MONTHS", 1);
136
* <p>A constant that represents the days field.</p>
138
public static final Field DAYS = new Field("DAYS", 2);
141
* <p>A constant that represents the hours field.</p>
143
public static final Field HOURS = new Field("HOURS", 3);
146
* <p>A constant that represents the minutes field.</p>
148
public static final Field MINUTES = new Field("MINUTES", 4);
151
* <p>A constant that represents the seconds field.</p>
153
public static final Field SECONDS = new Field("SECONDS", 5);
156
* Type-safe enum class that represents six fields
157
* of the {@link Duration} class.
159
public static final class Field {
162
* <p><code>String</code> representation of <ode>Field</code>.</p>
164
private final String str;
166
* <p>Unique id of the field.</p>
168
* <p>This value allows the {@link Duration} class to use switch
169
* statements to process fields.</p>
171
private final int id;
174
* <p>Construct a <code>Field</code> with specified values.</p>
175
* @param str <code>String</code> representation of <code>Field</code>
176
* @param id <code>int</code> representation of <code>Field</code>
178
private Field(final String str, final int id) {
183
* Returns a field name in English. This method
184
* is intended to be used for debugging/diagnosis
185
* and not for display to end-users.
188
* a non-null valid String constant.
190
public String toString() { return str; }
193
* <p>Get id of this Field.</p>
195
* @return Id of field.
203
* <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>dateTime</code>.</p>
205
public static final QName DATETIME = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "dateTime");
208
* <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>time</code>.</p>
210
public static final QName TIME = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "time");
213
* <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>date</code>.</p>
215
public static final QName DATE = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "date");
218
* <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gYearMonth</code>.</p>
220
public static final QName GYEARMONTH = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gYearMonth");
223
* <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gMonthDay</code>.</p>
225
public static final QName GMONTHDAY = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gMonthDay");
228
* <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gYear</code>.</p>
230
public static final QName GYEAR = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gYear");
233
* <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gMonth</code>.</p>
235
public static final QName GMONTH = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gMonth");
238
* <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gDay</code>.</p>
240
public static final QName GDAY = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gDay");
243
* <p>Fully qualified name for W3C XML Schema datatype <code>duration</code>.</p>
245
public static final QName DURATION = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "duration");
248
* <p>Fully qualified name for XQuery 1.0 and XPath 2.0 datatype <code>dayTimeDuration</code>.</p>
250
public static final QName DURATION_DAYTIME = new QName(XMLConstants.W3C_XPATH_DATATYPE_NS_URI, "dayTimeDuration");
253
* <p>Fully qualified name for XQuery 1.0 and XPath 2.0 datatype <code>yearMonthDuration</code>.</p>
255
public static final QName DURATION_YEARMONTH = new QName(XMLConstants.W3C_XPATH_DATATYPE_NS_URI, "yearMonthDuration");
258
* W3C XML Schema max timezone offset is -14:00. Zone offset is in minutes.
260
public static final int MAX_TIMEZONE_OFFSET = -14 * 60;
263
* W3C XML Schema min timezone offset is +14:00. Zone offset is in minutes.
265
public static final int MIN_TIMEZONE_OFFSET = 14 * 60;