01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 2007.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.model.impl;
07:
08: import javax.xml.datatype.XMLGregorianCalendar;
09:
10: import org.openrdf.model.datatypes.XMLDatatypeUtil;
11:
12: /**
13: * An extension of {@link LiteralImpl} that stores a calendar value to avoid
14: * parsing.
15: *
16: * @author David Huynh
17: * @author Arjohn Kampman
18: */
19: public class CalendarLiteralImpl extends LiteralImpl {
20:
21: private static final long serialVersionUID = -8959671333074894312L;
22:
23: private final XMLGregorianCalendar calendar;
24:
25: /**
26: * Creates a literal for the specified calendar using a datatype appropriate
27: * for the value indicated by {@link XMLGregorianCalendar#getXMLSchemaType()}.
28: */
29: public CalendarLiteralImpl(XMLGregorianCalendar calendar) {
30: super (calendar.toXMLFormat(), XMLDatatypeUtil
31: .qnameToURI(calendar.getXMLSchemaType()));
32: this .calendar = calendar;
33: }
34:
35: @Override
36: public XMLGregorianCalendar calendarValue() {
37: return calendar;
38: }
39: }
|