Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 package org.apache.xmlrpc.util;
00020
00021 import java.text.FieldPosition;
00022 import java.text.ParsePosition;
00023 import java.util.Calendar;
00024 import java.util.Date;
00025
00026
00027
00031 public abstract class XmlRpcDateTimeDateFormat extends XmlRpcDateTimeFormat {
00032 private static final long serialVersionUID = -5107387618606150784L;
00033
00034 public StringBuffer format(Object pCalendar, StringBuffer pBuffer, FieldPosition pPos) {
00035 final Object cal;
00036 if (pCalendar != null && pCalendar instanceof Date) {
00037 Calendar calendar = Calendar.getInstance(getTimeZone());
00038 calendar.setTime((Date) pCalendar);
00039 cal = calendar;
00040 } else {
00041 cal = pCalendar;
00042 }
00043 return super.format(cal, pBuffer, pPos);
00044 }
00045
00046 public Object parseObject(String pString, ParsePosition pParsePosition) {
00047 Calendar cal = (Calendar) super.parseObject(pString, pParsePosition);
00048 return cal == null ? null : cal.getTime();
00049 }
00050 }