2
* Copyright 2004,2005 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.
16
package org.apache.xerces.xs.datatypes;
18
import javax.xml.datatype.Duration;
19
import javax.xml.datatype.XMLGregorianCalendar;
22
* <p>Interface to expose the values for all date-time related types. The following
23
* table shows the methods defined for various XML Schema 1.0 built-in types. 'X'
24
* marks whether a particular method is defined for a particular type. Accessing undefined
25
* methods may return unexpected values.
30
* <td> XML Schema Datatype </td>
31
* <td> getYears() </td>
32
* <td> getMonths() </td>
33
* <td> getDays() </td>
34
* <td> getHours() </td>
35
* <td> getMinutes() </td>
36
* <td> getSeconds() </td>
37
* <td> getTimeZoneHours() </td>
38
* <td> getTimeZoneMinutes() </td>
39
* <td> getXMLGregorianCalendar() </td>
40
* <td> getDuration() </td>
41
* <td> hasTimeZone() </td>
42
* <td> normalize() </td>
43
* <td> isNormalized() </td>
44
* <td> getLexicalValue() </td>
98
* <td> gYearMonth </td>
115
* <td> gMonthDay </td>
166
* <td> datetime </td>
183
* <td> duration </td>
202
* @author Ankit Pasricha, IBM
204
* @version $Id: XSDateTime.java 320368 2005-05-15 20:37:23Z mrglavas $
206
public interface XSDateTime {
209
* @return years - can be negative for date-time related types;
212
public int getYears();
215
* @return months - can be negative only for duration types;
216
* For duration types, it returns years*12 + months
218
public int getMonths();
221
* @return days - cannot be negative;
224
public int getDays();
227
* @return hours - cannot be negative;
230
public int getHours();
233
* @return minutes - cannot be negative;
236
public int getMinutes();
239
* @return seconds - can be negative only for durations;
240
* For duration types, it returns days*24*3600 + hours*3600
241
* + minutes*60 + seconds
243
public double getSeconds();
246
* @return boolean (true when timezone is specified in the original lexical value)
249
public boolean hasTimeZone();
252
* @return timezone hours (for GMT-xx:xx this will be negative),
255
public int getTimeZoneHours();
258
* @return timezone minutes (for GMT-xx:xx this will be negative),
261
public int getTimeZoneMinutes();
264
* @return the original lexical value
266
public String getLexicalValue();
269
* @return a new date-time related object with normalized values
270
* (has no effect on objects already
273
public XSDateTime normalize();
276
* @return whether a date-time related object is normalized or not
277
* (value is not useful for types where timezone is not specified)
279
public boolean isNormalized();
282
* @return an un-normalized XMLGregorianCalendar (if applicable otherwise null)
284
public XMLGregorianCalendar getXMLGregorianCalendar();
287
* @return a Duration (if applicable otherwise null)
289
public Duration getDuration();