2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
9
* http://www.apache.org/licenses/LICENSE-2.0
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
17
package org.apache.xerces.xs.datatypes;
19
import javax.xml.datatype.Duration;
20
import javax.xml.datatype.XMLGregorianCalendar;
23
* <p>Interface to expose the values for all date-time related types. The following
24
* table shows the methods defined for various XML Schema 1.0 built-in types. 'X'
25
* marks whether a particular method is defined for a particular type. Accessing undefined
26
* methods may return unexpected values.
31
* <td> XML Schema Datatype </td>
32
* <td> getYears() </td>
33
* <td> getMonths() </td>
34
* <td> getDays() </td>
35
* <td> getHours() </td>
36
* <td> getMinutes() </td>
37
* <td> getSeconds() </td>
38
* <td> getTimeZoneHours() </td>
39
* <td> getTimeZoneMinutes() </td>
40
* <td> getXMLGregorianCalendar() </td>
41
* <td> getDuration() </td>
42
* <td> hasTimeZone() </td>
43
* <td> normalize() </td>
44
* <td> isNormalized() </td>
45
* <td> getLexicalValue() </td>
99
* <td> gYearMonth </td>
116
* <td> gMonthDay </td>
167
* <td> datetime </td>
184
* <td> duration </td>
203
* @author Ankit Pasricha, IBM
205
* @version $Id: XSDateTime.java,v 1.2 2009/12/10 03:18:45 matthewoliver Exp $
207
public interface XSDateTime {
210
* @return years - can be negative for date-time related types;
213
public int getYears();
216
* @return months - can be negative only for duration types;
217
* For duration types, it returns years*12 + months
219
public int getMonths();
222
* @return days - cannot be negative;
225
public int getDays();
228
* @return hours - cannot be negative;
231
public int getHours();
234
* @return minutes - cannot be negative;
237
public int getMinutes();
240
* @return seconds - can be negative only for durations;
241
* For duration types, it returns days*24*3600 + hours*3600
242
* + minutes*60 + seconds
244
public double getSeconds();
247
* @return boolean (true when timezone is specified in the original lexical value)
250
public boolean hasTimeZone();
253
* @return timezone hours (for GMT-xx:xx this will be negative),
256
public int getTimeZoneHours();
259
* @return timezone minutes (for GMT-xx:xx this will be negative),
262
public int getTimeZoneMinutes();
265
* @return the original lexical value
267
public String getLexicalValue();
270
* @return a new date-time related object with normalized values
271
* (has no effect on objects already
274
public XSDateTime normalize();
277
* @return whether a date-time related object is normalized or not
278
* (value is not useful for types where timezone is not specified)
280
public boolean isNormalized();
283
* @return an un-normalized XMLGregorianCalendar (if applicable otherwise null)
285
public XMLGregorianCalendar getXMLGregorianCalendar();
288
* @return a Duration (if applicable otherwise null)
290
public Duration getDuration();