protected KeyDeserializer _handleUnknownKeyDeserializer(JavaType type) throws JsonMappingException { throw new JsonMappingException("Can not find a (Map) Key deserializer for type "+type); }
protected void _reportSelfReference(Object bean) throws JsonMappingException { throw new JsonMappingException("Direct self-reference leading to cycle"); }
protected void failForEmpty(Object value) throws JsonMappingException { throw new JsonMappingException("No serializer found for class "+value.getClass().getName()+" and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) )"); } }
/** * Method to called to create value instance from JSON Object using * an intermediate "delegate" value to pass to createor method */ public Object createUsingDelegate(Object delegate) throws IOException, JsonProcessingException { throw new JsonMappingException("Can not instantiate value of type " +getValueTypeDesc()+" using delegate"); }
protected JsonDeserializer<Object> _handleUnknownValueDeserializer(JavaType type) throws JsonMappingException { // Let's try to figure out the reason, to give better error Class<?> rawClass = type.getRawClass(); if (!ClassUtil.isConcrete(rawClass)) { throw new JsonMappingException("Can not find a Value deserializer for abstract type "+type); } throw new JsonMappingException("Can not find a Value deserializer for type "+type); }
public static JsonMappingException from(JsonParser jp, String msg, Throwable problem) { return new JsonMappingException(msg, jp.getTokenLocation(), problem); }
protected void _reportProblem(JsonParser jp, String msg) throws JsonMappingException { throw new JsonMappingException(msg, jp.getTokenLocation()); }
protected JsonMappingException wrapException(Throwable t) { while (t.getCause() != null) { t = t.getCause(); } return new JsonMappingException("Instantiation of "+getValueTypeDesc()+" value failed: "+t.getMessage(), t); } }
/** * Method called to create value instance from JSON Object when * instantiation arguments are passed; this is done, for example when passing information * specified with "Creator" annotations. *<p> * This method is called if {@link #getFromObjectArguments} returns * a non-empty List of arguments. */ public Object createFromObjectWith(Object[] args) throws IOException, JsonProcessingException { throw new JsonMappingException("Can not instantiate value of type " +getValueTypeDesc()+" with arguments"); }
public Object createFromDouble(double value) throws IOException, JsonProcessingException { throw new JsonMappingException("Can not instantiate value of type " +getValueTypeDesc()+" from JSON floating-point number"); }
public static JsonMappingException from(JsonParser jp, String msg) { return new JsonMappingException(msg, jp.getTokenLocation()); }
public void getAndSerialize(Object bean, JsonGenerator jgen, SerializerProvider provider) throws Exception { Object value = _anyGetter.invoke(bean); if (value == null) { return; } if (!(value instanceof Map<?,?>)) { throw new JsonMappingException("Value returned by 'any-getter' ("+_anyGetter.getName()+"()) not java.util.Map but " +value.getClass().getName()); } _serializer.serializeFields((Map<?,?>) value, jgen, provider); }
public Object createFromString(String value) throws IOException, JsonProcessingException { throw new JsonMappingException("Can not instantiate value of type " +getValueTypeDesc()+" from JSON String"); }
public Object createFromInt(int value) throws IOException, JsonProcessingException { throw new JsonMappingException("Can not instantiate value of type " +getValueTypeDesc()+" from JSON int number"); }
public Object createFromLong(long value) throws IOException, JsonProcessingException { throw new JsonMappingException("Can not instantiate value of type " +getValueTypeDesc()+" from JSON long number"); }
public Object createFromBoolean(boolean value) throws IOException, JsonProcessingException { throw new JsonMappingException("Can not instantiate value of type " +getValueTypeDesc()+" from JSON boolean value"); }
/** * Method called to create value instance from a JSON value when * no data needs to passed to creator (constructor, factory method); * typically this will call the default constructor of the value object. * It will only be used if more specific creator methods are not * applicable; hence "default". *<p> * This method is called if {@link #getFromObjectArguments} returns * null or empty List. */ public Object createUsingDefault() throws IOException, JsonProcessingException { throw new JsonMappingException("Can not instantiate value of type " +getValueTypeDesc()+"; no default creator found"); }
@Override public Object createFromLong(long value) throws IOException, JsonProcessingException { try { if (_fromLongCreator != null) { return _fromLongCreator.call1(Long.valueOf(value)); } } catch (Exception e) { throw wrapException(e); } throw new JsonMappingException("Can not instantiate value of type "+getValueTypeDesc() +" from JSON long integral number; no single-long-arg constructor/factory method"); }
@Override public Object createFromDouble(double value) throws IOException, JsonProcessingException { try { if (_fromDoubleCreator != null) { return _fromDoubleCreator.call1(Double.valueOf(value)); } } catch (Exception e) { throw wrapException(e); } throw new JsonMappingException("Can not instantiate value of type "+getValueTypeDesc() +" from JSON floating-point number; no one-double/Double-arg constructor/factory method"); }
@Override public Object createFromBoolean(boolean value) throws IOException, JsonProcessingException { try { if (_fromBooleanCreator != null) { return _fromBooleanCreator.call1(Boolean.valueOf(value)); } } catch (Exception e) { throw wrapException(e); } throw new JsonMappingException("Can not instantiate value of type "+getValueTypeDesc() +" from JSON boolean value; no single-boolean/Boolean-arg constructor/factory method"); }