Java tutorial
package com.fasterxml.jackson.databind.deser.std; import com.fasterxml.jackson.annotation.JsonFormat.Value; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.AnnotationIntrospector; import com.fasterxml.jackson.databind.BeanProperty; import com.fasterxml.jackson.databind.DeserializationConfig; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.util.StdDateFormat; import java.sql.Timestamp; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.Locale; import java.util.TimeZone; public class DateDeserializers { public static StdDeserializer<?>[] all() { StdDeserializer[] arrayOfStdDeserializer = new StdDeserializer[6]; arrayOfStdDeserializer[0] = new CalendarDeserializer(); arrayOfStdDeserializer[1] = new DateDeserializer(); arrayOfStdDeserializer[2] = new CalendarDeserializer(GregorianCalendar.class); arrayOfStdDeserializer[3] = new SqlDateDeserializer(); arrayOfStdDeserializer[4] = new TimestampDeserializer(); arrayOfStdDeserializer[5] = new TimeZoneDeserializer(); return arrayOfStdDeserializer; } @JacksonStdImpl public static class CalendarDeserializer extends DateDeserializers.DateBasedDeserializer<Calendar> { protected final Class<? extends Calendar> _calendarClass; public CalendarDeserializer() { super(); this._calendarClass = null; } public CalendarDeserializer(CalendarDeserializer paramCalendarDeserializer, DateFormat paramDateFormat, String paramString) { super(paramDateFormat, paramString); this._calendarClass = paramCalendarDeserializer._calendarClass; } public CalendarDeserializer(Class<? extends Calendar> paramClass) { super(); this._calendarClass = paramClass; } public Calendar deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext) { java.util.Date localDate = _parseDate(paramJsonParser, paramDeserializationContext); if (localDate == null) return null; if (this._calendarClass == null) return paramDeserializationContext.constructCalendar(localDate); try { Calendar localCalendar = (Calendar) this._calendarClass.newInstance(); localCalendar.setTimeInMillis(localDate.getTime()); return localCalendar; } catch (Exception localException) { throw paramDeserializationContext.instantiationException(this._calendarClass, localException); } } protected CalendarDeserializer withDateFormat(DateFormat paramDateFormat, String paramString) { return new CalendarDeserializer(this, paramDateFormat, paramString); } } protected static abstract class DateBasedDeserializer<T> extends StdScalarDeserializer<T> implements ContextualDeserializer { protected final DateFormat _customFormat; protected final String _formatString; protected DateBasedDeserializer(DateBasedDeserializer<T> paramDateBasedDeserializer, DateFormat paramDateFormat, String paramString) { super(); this._customFormat = paramDateFormat; this._formatString = paramString; } protected DateBasedDeserializer(Class<?> paramClass) { super(); this._customFormat = null; this._formatString = null; } protected java.util.Date _parseDate(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext) { if ((this._customFormat != null) && (paramJsonParser.getCurrentToken() == JsonToken.VALUE_STRING)) { String str = paramJsonParser.getText().trim(); if (str.length() == 0) return (java.util.Date) getEmptyValue(); try { synchronized (this._customFormat) { java.util.Date localDate = this._customFormat.parse(str); return localDate; } } catch (ParseException localParseException) { throw new IllegalArgumentException("Failed to parse Date value '" + str + "' (format: \"" + this._formatString + "\"): " + localParseException.getMessage()); } } return super._parseDate(paramJsonParser, paramDeserializationContext); } public JsonDeserializer<?> createContextual(DeserializationContext paramDeserializationContext, BeanProperty paramBeanProperty) { TimeZone localTimeZone1; String str; SimpleDateFormat localSimpleDateFormat; if (paramBeanProperty != null) { JsonFormat.Value localValue = paramDeserializationContext.getAnnotationIntrospector() .findFormat(paramBeanProperty.getMember()); if (localValue != null) { localTimeZone1 = localValue.getTimeZone(); str = localValue.getPattern(); if (str.length() <= 0) break label101; Locale localLocale = localValue.getLocale(); if (localLocale == null) localLocale = paramDeserializationContext.getLocale(); localSimpleDateFormat = new SimpleDateFormat(str, localLocale); if (localTimeZone1 != null) break label166; } } label166: for (TimeZone localTimeZone2 = paramDeserializationContext .getTimeZone();; localTimeZone2 = localTimeZone1) { localSimpleDateFormat.setTimeZone(localTimeZone2); this = withDateFormat(localSimpleDateFormat, str); label101: do return this; while (localTimeZone1 == null); DateFormat localDateFormat = paramDeserializationContext.getConfig().getDateFormat(); Object localObject; if (localDateFormat.getClass() == StdDateFormat.class) localObject = ((StdDateFormat) localDateFormat).withTimeZone(localTimeZone1); while (true) { return withDateFormat((DateFormat) localObject, str); localObject = (DateFormat) localDateFormat.clone(); ((DateFormat) localObject).setTimeZone(localTimeZone1); } } } protected abstract DateBasedDeserializer<T> withDateFormat(DateFormat paramDateFormat, String paramString); } public static class DateDeserializer extends DateDeserializers.DateBasedDeserializer<java.util.Date> { public DateDeserializer() { super(); } public DateDeserializer(DateDeserializer paramDateDeserializer, DateFormat paramDateFormat, String paramString) { super(paramDateFormat, paramString); } public java.util.Date deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext) { return _parseDate(paramJsonParser, paramDeserializationContext); } protected DateDeserializer withDateFormat(DateFormat paramDateFormat, String paramString) { return new DateDeserializer(this, paramDateFormat, paramString); } } public static class SqlDateDeserializer extends DateDeserializers.DateBasedDeserializer<java.sql.Date> { public SqlDateDeserializer() { super(); } public SqlDateDeserializer(SqlDateDeserializer paramSqlDateDeserializer, DateFormat paramDateFormat, String paramString) { super(paramDateFormat, paramString); } public java.sql.Date deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext) { java.util.Date localDate = _parseDate(paramJsonParser, paramDeserializationContext); if (localDate == null) return null; return new java.sql.Date(localDate.getTime()); } protected SqlDateDeserializer withDateFormat(DateFormat paramDateFormat, String paramString) { return new SqlDateDeserializer(this, paramDateFormat, paramString); } } protected static class TimeZoneDeserializer extends FromStringDeserializer<TimeZone> { public TimeZoneDeserializer() { super(); } protected TimeZone _deserialize(String paramString, DeserializationContext paramDeserializationContext) { return TimeZone.getTimeZone(paramString); } } public static class TimestampDeserializer extends DateDeserializers.DateBasedDeserializer<Timestamp> { public TimestampDeserializer() { super(); } public TimestampDeserializer(TimestampDeserializer paramTimestampDeserializer, DateFormat paramDateFormat, String paramString) { super(paramDateFormat, paramString); } public Timestamp deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext) { return new Timestamp(_parseDate(paramJsonParser, paramDeserializationContext).getTime()); } protected TimestampDeserializer withDateFormat(DateFormat paramDateFormat, String paramString) { return new TimestampDeserializer(this, paramDateFormat, paramString); } } } /* Location: /Users/dantheman/src/fffffffffattttt/basis/classes_dex2jar.jar * Qualified Name: com.fasterxml.jackson.databind.deser.std.DateDeserializers * JD-Core Version: 0.6.2 */