public static JsonDeserializer<?> find(Class<?> rawType, String clsName) { if (_classNames.contains(clsName)) { // Start with the most common type if (rawType == Calendar.class) { return new CalendarDeserializer(); } if (rawType == java.util.Date.class) { return DateDeserializer.instance; } if (rawType == java.sql.Date.class) { return new SqlDateDeserializer(); } if (rawType == Timestamp.class) { return new TimestampDeserializer(); } if (rawType == GregorianCalendar.class) { return new CalendarDeserializer(GregorianCalendar.class); } } return null; }
@Override public Calendar deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { Date d = _parseDate(p, ctxt); if (d == null) { return null; } if (_defaultCtor == null) { return ctxt.constructCalendar(d); } try { Calendar c = _defaultCtor.newInstance(); c.setTimeInMillis(d.getTime()); TimeZone tz = ctxt.getTimeZone(); if (tz != null) { c.setTimeZone(tz); } return c; } catch (Exception e) { return (Calendar) ctxt.handleInstantiationProblem(handledType(), d, e); } } }
public static JsonDeserializer<?> find(Class<?> rawType, String clsName) { if (_classNames.contains(clsName)) { // Start with the most common type if (rawType == Calendar.class) { return new CalendarDeserializer(); } if (rawType == java.util.Date.class) { return DateDeserializer.instance; } if (rawType == java.sql.Date.class) { return new SqlDateDeserializer(); } if (rawType == Timestamp.class) { return new TimestampDeserializer(); } if (rawType == GregorianCalendar.class) { return new CalendarDeserializer(GregorianCalendar.class); } } return null; }
public static JsonDeserializer<?> find(Class<?> rawType, String clsName) { if (_classNames.contains(clsName)) { // Start with the most common type if (rawType == Calendar.class) { return new CalendarDeserializer(); } if (rawType == java.util.Date.class) { return DateDeserializer.instance; } if (rawType == java.sql.Date.class) { return new SqlDateDeserializer(); } if (rawType == Timestamp.class) { return new TimestampDeserializer(); } if (rawType == GregorianCalendar.class) { return new CalendarDeserializer(GregorianCalendar.class); } } return null; }
public static JsonDeserializer<?> find(Class<?> rawType, String clsName) { if (_classNames.contains(clsName)) { // Start with the most common type if (rawType == Calendar.class) { return new CalendarDeserializer(); } if (rawType == java.util.Date.class) { return DateDeserializer.instance; } if (rawType == java.sql.Date.class) { return new SqlDateDeserializer(); } if (rawType == Timestamp.class) { return new TimestampDeserializer(); } if (rawType == GregorianCalendar.class) { return new CalendarDeserializer(GregorianCalendar.class); } } return null; }
public static JsonDeserializer<?> find(Class<?> rawType, String clsName) { if (_classNames.contains(clsName)) { // Start with the most common type if (rawType == Calendar.class) { return new CalendarDeserializer(); } if (rawType == java.util.Date.class) { return DateDeserializer.instance; } if (rawType == java.sql.Date.class) { return new SqlDateDeserializer(); } if (rawType == Timestamp.class) { return new TimestampDeserializer(); } if (rawType == GregorianCalendar.class) { return new CalendarDeserializer(GregorianCalendar.class); } } return null; }
@Override public Calendar deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { Date d = _parseDate(p, ctxt); if (d == null) { return null; } if (_calendarClass == null) { return ctxt.constructCalendar(d); } try { Calendar c = _calendarClass.newInstance(); c.setTimeInMillis(d.getTime()); TimeZone tz = ctxt.getTimeZone(); if (tz != null) { c.setTimeZone(tz); } return c; } catch (Exception e) { return (Calendar) ctxt.handleInstantiationProblem(_calendarClass, d, e); } } }
@Override public Calendar deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { Date d = _parseDate(jp, ctxt); if (d == null) { return null; } if (_calendarClass == null) { return ctxt.constructCalendar(d); } try { Calendar c = _calendarClass.newInstance(); c.setTimeInMillis(d.getTime()); TimeZone tz = ctxt.getTimeZone(); if (tz != null) { c.setTimeZone(tz); } return c; } catch (Exception e) { throw ctxt.instantiationException(_calendarClass, e); } } }
@Override public Calendar deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { Date d = _parseDate(p, ctxt); if (d == null) { return null; } if (_defaultCtor == null) { return ctxt.constructCalendar(d); } try { Calendar c = _defaultCtor.newInstance(); c.setTimeInMillis(d.getTime()); TimeZone tz = ctxt.getTimeZone(); if (tz != null) { c.setTimeZone(tz); } return c; } catch (Exception e) { return (Calendar) ctxt.handleInstantiationProblem(handledType(), d, e); } } }
@Override public Calendar deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { Date d = _parseDate(jp, ctxt); if (d == null) { return null; } if (_calendarClass == null) { return ctxt.constructCalendar(d); } try { Calendar c = _calendarClass.newInstance(); c.setTimeInMillis(d.getTime()); return c; } catch (Exception e) { throw ctxt.instantiationException(_calendarClass, e); } } }
@Override public Calendar deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { Date d = _parseDate(jp, ctxt); if (d == null) { return null; } if (_calendarClass == null) { return ctxt.constructCalendar(d); } try { Calendar c = _calendarClass.newInstance(); c.setTimeInMillis(d.getTime()); return c; } catch (Exception e) { throw ctxt.instantiationException(_calendarClass, e); } } }
@Override public Calendar deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { Date d = _parseDate(jp, ctxt); if (d == null) { return null; } if (_calendarClass == null) { return ctxt.constructCalendar(d); } try { Calendar c = _calendarClass.newInstance(); c.setTimeInMillis(d.getTime()); TimeZone tz = ctxt.getTimeZone(); if (tz != null) { c.setTimeZone(tz); } return c; } catch (Exception e) { throw ctxt.instantiationException(_calendarClass, e); } } }
@Override @Nullable public T deserialize( @Nonnull final JsonParser jsonParser, @Nonnull final DeserializationContext deserializationContext ) throws IOException { final Calendar cal = new DateDeserializers.CalendarDeserializer().deserialize(jsonParser, deserializationContext); try { return getConverterInstance().fromDomain(cal).orNull(); } catch( final Exception e ) { throw new IOException("Could not convert the read Calendar: " + cal, e); } } }
public static StdDeserializer<?>[] all() { return new StdDeserializer[] { new CalendarDeserializer(), // for nominal type of java.util.Calendar new DateDeserializer(), /* 24-Jan-2010, tatu: When including type information, we may * know that we specifically need GregorianCalendar... */ new CalendarDeserializer(GregorianCalendar.class), new SqlDateDeserializer(), new TimestampDeserializer(), new TimeZoneDeserializer() }; }
@Override protected CalendarDeserializer withDateFormat(DateFormat df, String formatString) { return new CalendarDeserializer(this, df, formatString); }
@Override protected CalendarDeserializer withDateFormat(DateFormat df, String formatString) { return new CalendarDeserializer(this, df, formatString); }
@Override protected CalendarDeserializer withDateFormat(DateFormat df, String formatString) { return new CalendarDeserializer(this, df, formatString); }
public static StdDeserializer<?>[] all() { return new StdDeserializer[] { new CalendarDeserializer(), // for nominal type of java.util.Calendar new DateDeserializer(), /* 24-Jan-2010, tatu: When including type information, we may * know that we specifically need GregorianCalendar... */ new CalendarDeserializer(GregorianCalendar.class), new SqlDateDeserializer(), new TimestampDeserializer(), new TimeZoneDeserializer() }; }
@Override protected CalendarDeserializer withDateFormat(DateFormat df, String formatString) { return new CalendarDeserializer(this, df, formatString); }
@Override protected CalendarDeserializer withDateFormat(DateFormat df, String formatString) { return new CalendarDeserializer(this, df, formatString); }