@Override
 public Map<Object, Object> deserialize(JsonParser jp, DeserializationContext ctxt)
     throws IOException, JsonProcessingException {
   // Ok: must point to START_OBJECT, or FIELD_NAME
   JsonToken t = jp.getCurrentToken();
   if (t != JsonToken.START_OBJECT && t != JsonToken.FIELD_NAME) {
     throw ctxt.mappingException(getMapClass());
   }
   if (_propertyBasedCreator != null) {
     return _deserializeUsingCreator(jp, ctxt);
   }
   Map<Object, Object> result;
   if (_defaultCtor == null) {
     throw ctxt.instantiationException(getMapClass(), "No default constructor found");
   }
   try {
     result = _defaultCtor.newInstance();
   } catch (Exception e) {
     throw ctxt.instantiationException(getMapClass(), e);
   }
   _readAndBind(jp, ctxt, result);
   return result;
 }
Exemplo n.º 2
0
 @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);
   }
 }