1 29 30 package com.caucho.jaxb.skeleton; 31 import com.caucho.jaxb.*; 32 import javax.xml.bind.*; 33 import javax.xml.namespace.*; 34 import javax.xml.stream.*; 35 import java.util.*; 36 import java.text.*; 37 38 import java.lang.reflect.*; 39 import java.io.*; 40 41 import com.caucho.vfs.WriteStream; 42 43 46 public class DateTimeProperty extends CDataProperty { 47 public static final DateTimeProperty PROPERTY = new DateTimeProperty(); 48 49 protected String write(Object in) 50 throws IOException, XMLStreamException 51 { 52 Date date = (Date) in; 53 Calendar calendar = new GregorianCalendar(); 54 calendar.setTime(date); 55 return DatatypeConverter.printDateTime(calendar); 56 } 57 58 protected Object read(String in) 59 throws IOException, XMLStreamException 60 { 61 return DatatypeConverter.parseDate(in).getTime(); 62 } 63 64 public String getSchemaType() 65 { 66 return "xsd:dateTime"; 67 } 68 } 69 70 71 | Popular Tags |