コード例 #1
0
 /**
  * Helper method for constructing exception to indicate that given JSON Object field name was not
  * in format to be able to deserialize specified key type.
  */
 public JsonMappingException weirdKeyException(Class<?> keyClass, String keyValue, String msg) {
   return InvalidFormatException.from(
       _parser,
       "Can not construct Map key of type "
           + keyClass.getName()
           + " from String \""
           + _desc(keyValue)
           + "\": "
           + msg,
       keyValue,
       keyClass);
 }
コード例 #2
0
 /**
  * Helper method for constructing exception to indicate that input JSON Number was not suitable
  * for deserializing into given target type.
  */
 public JsonMappingException weirdNumberException(Number value, Class<?> instClass, String msg) {
   return InvalidFormatException.from(
       _parser,
       "Can not construct instance of "
           + instClass.getName()
           + " from number value ("
           + _valueDesc()
           + "): "
           + msg,
       null,
       instClass);
 }
コード例 #3
0
 /**
  * Method that will construct an exception suitable for throwing when some String values are
  * acceptable, but the one encountered is not.
  *
  * @param value String value from input being deserialized
  * @param instClass Type that String should be deserialized into
  * @param msg Message that describes specific problem
  * @since 2.1
  */
 public JsonMappingException weirdStringException(String value, Class<?> instClass, String msg) {
   return InvalidFormatException.from(
       _parser,
       "Can not construct instance of "
           + instClass.getName()
           + " from String value '"
           + _valueDesc()
           + "': "
           + msg,
       value,
       instClass);
 }
コード例 #4
0
 protected String _calcName(Class<?> cls) {
   if (cls.isArray()) {
     return _calcName(cls.getComponentType()) + "[]";
   }
   return cls.getName();
 }
コード例 #5
0
 public JsonMappingException endOfInputException(Class<?> instClass) {
   return JsonMappingException.from(
       _parser, "Unexpected end-of-input when trying to deserialize a " + instClass.getName());
 }
コード例 #6
0
 public JsonMappingException instantiationException(Class<?> instClass, String msg) {
   return JsonMappingException.from(
       _parser, "Can not construct instance of " + instClass.getName() + ", problem: " + msg);
 }
コード例 #7
0
 /**
  * Helper method for constructing instantiation exception for specified type, to indicate problem
  * with physically constructing instance of specified class (missing constructor, exception from
  * constructor)
  */
 public JsonMappingException instantiationException(Class<?> instClass, Throwable t) {
   return JsonMappingException.from(
       _parser,
       "Can not construct instance of " + instClass.getName() + ", problem: " + t.getMessage(),
       t);
 }