KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > datatype > DatatypeConstants


1 // $Id: DatatypeConstants.java,v 1.2.2.1 2004/04/28 23:12:57 jsuttor Exp $
2

3 /*
4  * @(#)DatatypeConstants.java 1.2 04/07/26
5  *
6  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
7  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
8  */

9
10 package javax.xml.datatype;
11
12 import javax.xml.XMLConstants JavaDoc;
13 import javax.xml.namespace.QName JavaDoc;
14
15 /**
16  * <p>Utility class to contain basic Datatype values as constants.</p>
17  *
18  * @author <a HREF="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
19  * @version $Revision: 1.2.2.1 $, $Date: 2004/04/28 23:12:57 $
20  * @since 1.5
21  */

22
23 public final class DatatypeConstants {
24     
25     /**
26      * <p>Private constructor to prevent instantiation.</p>
27      */

28     private DatatypeConstants() {
29     }
30     
31     /**
32      * Value for first month of year.
33      */

34     public static final int JANUARY = 1;
35
36     /**
37      * Value for second month of year.
38      */

39     public static final int FEBRUARY = 2;
40
41     /**
42      * Value for third month of year.
43      */

44     public static final int MARCH = 3;
45
46     /**
47      * Value for fourth month of year.
48      */

49     public static final int APRIL = 4;
50
51     /**
52      * Value for fifth month of year.
53      */

54     public static final int MAY = 5;
55
56     /**
57      * Value for sixth month of year.
58      */

59     public static final int JUNE = 6;
60
61     /**
62      * Value for seventh month of year.
63      */

64     public static final int JULY = 7;
65
66     /**
67      * Value for eighth month of year.
68      */

69     public static final int AUGUST = 8;
70
71     /**
72      * Value for ninth month of year.
73      */

74     public static final int SEPTEMBER = 9;
75
76     /**
77      * Value for tenth month of year.
78      */

79     public static final int OCTOBER = 10;
80
81     /**
82      * Value for eleven month of year.
83      */

84     public static final int NOVEMBER = 11;
85
86     /**
87      * Value for twelve month of year.
88      */

89     public static final int DECEMBER = 12;
90
91     /**
92      * <p>Comparison result.</p>
93      */

94     public static final int LESSER = -1;
95
96     /**
97      * <p>Comparison result.</p>
98      */

99     public static final int EQUAL = 0;
100
101     /**
102      * <p>Comparison result.</p>
103      */

104     public static final int GREATER = 1;
105
106     /**
107      * <p>Comparison result.</p>
108      */

109     public static final int INDETERMINATE = 2;
110     
111     /**
112      * Designation that an "int" field is not set.
113      */

114     public static final int FIELD_UNDEFINED = Integer.MIN_VALUE;
115
116     /**
117      * <p>A constant that represents the years field.</p>
118      */

119     public static final Field YEARS = new Field("YEARS", 0);
120     
121     /**
122      * <p>A constant that represents the months field.</p>
123      */

124     public static final Field MONTHS = new Field("MONTHS", 1);
125     
126     /**
127      * <p>A constant that represents the days field.</p>
128      */

129     public static final Field DAYS = new Field("DAYS", 2);
130     
131     /**
132      * <p>A constant that represents the hours field.</p>
133      */

134     public static final Field HOURS = new Field("HOURS", 3);
135     
136     /**
137      * <p>A constant that represents the minutes field.</p>
138      */

139     public static final Field MINUTES = new Field("MINUTES", 4);
140     
141     /**
142      * <p>A constant that represents the seconds field.</p>
143      */

144     public static final Field SECONDS = new Field("SECONDS", 5);
145     
146     /**
147      * Type-safe enum class that represents six fields
148      * of the {@link Duration} class.
149      */

150     public static final class Field {
151         
152         /**
153          * <p><code>String</code> representation of <ode>Field</code>.</p>
154          */

155         private final String JavaDoc str;
156         /**
157          * <p>Unique id of the field.</p>
158          *
159          * <p>This value allows the {@link Duration} class to use switch
160          * statements to process fields.</p>
161          */

162         private final int id;
163         
164         /**
165          * <p>Construct a <code>Field</code> with specified values.</p>
166          * @param str <code>String</code> representation of <code>Field</code>
167          * @param id <code>int</code> representation of <code>Field</code>
168          */

169         private Field(final String JavaDoc str, final int id) {
170             this.str = str;
171             this.id = id;
172         }
173         /**
174          * Returns a field name in English. This method
175          * is intended to be used for debugging/diagnosis
176          * and not for display to end-users.
177          *
178          * @return
179          * a non-null valid String constant.
180          */

181         public String JavaDoc toString() { return str; }
182         
183         /**
184          * <p>Get id of this Field.</p>
185          *
186          * @return Id of field.
187          */

188         public int getId() {
189             return id;
190         }
191     }
192     
193     /**
194      * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>dateTime</code>.</p>
195      */

196     public static final QName JavaDoc DATETIME = new QName JavaDoc(XMLConstants.W3C_XML_SCHEMA_NS_URI, "dateTime");
197
198     /**
199      * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>time</code>.</p>
200      */

201     public static final QName JavaDoc TIME = new QName JavaDoc(XMLConstants.W3C_XML_SCHEMA_NS_URI, "time");
202
203     /**
204      * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>date</code>.</p>
205      */

206     public static final QName JavaDoc DATE = new QName JavaDoc(XMLConstants.W3C_XML_SCHEMA_NS_URI, "date");
207
208     /**
209      * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gYearMonth</code>.</p>
210      */

211     public static final QName JavaDoc GYEARMONTH = new QName JavaDoc(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gYearMonth");
212
213     /**
214      * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gMonthDay</code>.</p>
215      */

216     public static final QName JavaDoc GMONTHDAY = new QName JavaDoc(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gMonthDay");
217
218     /**
219      * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gYear</code>.</p>
220      */

221     public static final QName JavaDoc GYEAR = new QName JavaDoc(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gYear");
222
223     /**
224      * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gMonth</code>.</p>
225      */

226     public static final QName JavaDoc GMONTH = new QName JavaDoc(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gMonth");
227
228     /**
229      * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gDay</code>.</p>
230      */

231     public static final QName JavaDoc GDAY = new QName JavaDoc(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gDay");
232
233     /**
234      * <p>Fully qualified name for W3C XML Schema datatype <code>duration</code>.</p>
235      */

236     public static final QName JavaDoc DURATION = new QName JavaDoc(XMLConstants.W3C_XML_SCHEMA_NS_URI, "duration");
237
238     /**
239      * <p>Fully qualified name for XQuery 1.0 and XPath 2.0 datatype <code>dayTimeDuration</code>.</p>
240      */

241     public static final QName JavaDoc DURATION_DAYTIME = new QName JavaDoc(XMLConstants.W3C_XPATH_DATATYPE_NS_URI, "dayTimeDuration");
242
243     /**
244      * <p>Fully qualified name for XQuery 1.0 and XPath 2.0 datatype <code>yearMonthDuration</code>.</p>
245      */

246     public static final QName JavaDoc DURATION_YEARMONTH = new QName JavaDoc(XMLConstants.W3C_XPATH_DATATYPE_NS_URI, "yearMonthDuration");
247
248     /**
249      * W3C XML Schema max timezone offset is -14:00. Zone offset is in minutes.
250      */

251     public static final int MAX_TIMEZONE_OFFSET = -14 * 60;
252
253     /**
254      * W3C XML Schema min timezone offset is +14:00. Zone offset is in minutes.
255      */

256     public static final int MIN_TIMEZONE_OFFSET = 14 * 60;
257     
258 }
259
Popular Tags