1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * https://jaxp.dev.java.net/CDDLv1.0.html. * See the License for the specific language governing * permissions and limitations under the License. * * When distributing Covered Code, include this CDDL * HEADER in each file and include the License file at * https://jaxp.dev.java.net/CDDLv1.0.html * If applicable add the following below this CDDL HEADER * with the fields enclosed by brackets "[]" replaced with * your own identifying information: Portions Copyright * [year] [name of copyright owner] */ /* * $Id: DatatypeConstants.java,v 1.4 2006/01/24 01:23:06 jeffsuttor Exp $ * @(#)DatatypeConstants.java 1.12 06/04/07 * * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. */ package javax.xml.datatype; import javax.xml.XMLConstants; import javax.xml.namespace.QName; /** * <p>Utility class to contain basic Datatype values as constants.</p> * * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a> * @version $Revision: 1.4 $, $Date: 2006/01/24 01:23:06 $ * @since 1.5 */ public final class DatatypeConstants { /** * <p>Private constructor to prevent instantiation.</p> */ private DatatypeConstants() { } /** * Value for first month of year. */ public static final int JANUARY = 1; /** * Value for second month of year. */ public static final int FEBRUARY = 2; /** * Value for third month of year. */ public static final int MARCH = 3; /** * Value for fourth month of year. */ public static final int APRIL = 4; /** * Value for fifth month of year. */ public static final int MAY = 5; /** * Value for sixth month of year. */ public static final int JUNE = 6; /** * Value for seventh month of year. */ public static final int JULY = 7; /** * Value for eighth month of year. */ public static final int AUGUST = 8; /** * Value for ninth month of year. */ public static final int SEPTEMBER = 9; /** * Value for tenth month of year. */ public static final int OCTOBER = 10; /** * Value for eleven month of year. */ public static final int NOVEMBER = 11; /** * Value for twelve month of year. */ public static final int DECEMBER = 12; /** * <p>Comparison result.</p> */ public static final int LESSER = -1; /** * <p>Comparison result.</p> */ public static final int EQUAL = 0; /** * <p>Comparison result.</p> */ public static final int GREATER = 1; /** * <p>Comparison result.</p> */ public static final int INDETERMINATE = 2; /** * Designation that an "int" field is not set. */ public static final int FIELD_UNDEFINED = Integer.MIN_VALUE; /** * <p>A constant that represents the years field.</p> */ public static final Field YEARS = new Field("YEARS", 0); /** * <p>A constant that represents the months field.</p> */ public static final Field MONTHS = new Field("MONTHS", 1); /** * <p>A constant that represents the days field.</p> */ public static final Field DAYS = new Field("DAYS", 2); /** * <p>A constant that represents the hours field.</p> */ public static final Field HOURS = new Field("HOURS", 3); /** * <p>A constant that represents the minutes field.</p> */ public static final Field MINUTES = new Field("MINUTES", 4); /** * <p>A constant that represents the seconds field.</p> */ public static final Field SECONDS = new Field("SECONDS", 5); /** * Type-safe enum class that represents six fields * of the {@link Duration} class. * @since 1.5 */ public static final class Field { /** * <p><code>String</code> representation of <code>Field</code>.</p> */ private final String str; /** * <p>Unique id of the field.</p> * * <p>This value allows the {@link Duration} class to use switch * statements to process fields.</p> */ private final int id; /** * <p>Construct a <code>Field</code> with specified values.</p> * @param str <code>String</code> representation of <code>Field</code> * @param id <code>int</code> representation of <code>Field</code> */ private Field(final String str, final int id) { this.str = str; this.id = id; } /** * Returns a field name in English. This method * is intended to be used for debugging/diagnosis * and not for display to end-users. * * @return * a non-null valid String constant. */ public String toString() { return str; } /** * <p>Get id of this Field.</p> * * @return Id of field. */ public int getId() { return id; } } /** * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>dateTime</code>.</p> */ public static final QName DATETIME = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "dateTime"); /** * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>time</code>.</p> */ public static final QName TIME = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "time"); /** * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>date</code>.</p> */ public static final QName DATE = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "date"); /** * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gYearMonth</code>.</p> */ public static final QName GYEARMONTH = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gYearMonth"); /** * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gMonthDay</code>.</p> */ public static final QName GMONTHDAY = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gMonthDay"); /** * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gYear</code>.</p> */ public static final QName GYEAR = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gYear"); /** * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gMonth</code>.</p> */ public static final QName GMONTH = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gMonth"); /** * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gDay</code>.</p> */ public static final QName GDAY = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gDay"); /** * <p>Fully qualified name for W3C XML Schema datatype <code>duration</code>.</p> */ public static final QName DURATION = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "duration"); /** * <p>Fully qualified name for XQuery 1.0 and XPath 2.0 datatype <code>dayTimeDuration</code>.</p> */ public static final QName DURATION_DAYTIME = new QName(XMLConstants.W3C_XPATH_DATATYPE_NS_URI, "dayTimeDuration"); /** * <p>Fully qualified name for XQuery 1.0 and XPath 2.0 datatype <code>yearMonthDuration</code>.</p> */ public static final QName DURATION_YEARMONTH = new QName(XMLConstants.W3C_XPATH_DATATYPE_NS_URI, "yearMonthDuration"); /** * W3C XML Schema max timezone offset is -14:00. Zone offset is in minutes. */ public static final int MAX_TIMEZONE_OFFSET = -14 * 60; /** * W3C XML Schema min timezone offset is +14:00. Zone offset is in minutes. */ public static final int MIN_TIMEZONE_OFFSET = 14 * 60; }