instanceOrClass = getValueClass(); reportUnknownProperty(ctxt, instanceOrClass, propName);
protected final short _parseShortPrimitive(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { int value = _parseIntPrimitive(jp, ctxt); // So far so good: but does it fit? if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) { throw ctxt.weirdStringException(_valueClass, "overflow, value can not be represented as 16-bit value"); } return (short) value; }
String text = jp.getText().trim(); if (text.length() == 0) { return (Float) getEmptyValue(); return (Float) getNullValue();
String text = jp.getText().trim(); if (text.length() == 0) { return (Double) getEmptyValue(); return parseDouble(text); } catch (IllegalArgumentException iae) { } throw ctxt.weirdStringException(_valueClass, "not a valid Double value"); return (Double) getNullValue();
return (jp.getIntValue() == 0) ? Boolean.FALSE : Boolean.TRUE; return Boolean.valueOf(_parseBooleanFromNumber(jp, ctxt)); return (Boolean) getNullValue(); return (Boolean) getEmptyValue();
private void add(StdDeserializer<?> stdDeser, Class<?> valueClass) { // must do some unfortunate casting here... @SuppressWarnings("unchecked") JsonDeserializer<Object> deser = (JsonDeserializer<Object>) stdDeser; // Not super clean, but default TypeFactory does work here: _deserializers.put(new ClassKey(valueClass), deser); } }
/** * Method called when a JSON property is encountered that has not matching * setter, any-setter or field, and thus can not be assigned. */ @Override protected void handleUnknownProperty(JsonParser jp, DeserializationContext ctxt, Object beanOrClass, String propName) throws IOException, JsonProcessingException { /* 22-Aug-2010, tatu: Caller now mostly checks for ignorable properties, so * following should not be necessary. However, "handleUnknownProperties()" seems * to still possibly need it so it is left for now. */ // If registered as ignorable, skip if (_ignoreAllUnknown || (_ignorableProps != null && _ignorableProps.contains(propName))) { jp.skipChildren(); return; } /* Otherwise use default handling (call handler(s); if not * handled, throw exception or skip depending on settings) */ super.handleUnknownProperty(jp, ctxt, beanOrClass, propName); }
return parseDouble(text); } catch (IllegalArgumentException iae) { } throw ctxt.weirdStringException(_valueClass, "not a valid double value");
return (jp.getIntValue() != 0); return _parseBooleanFromNumber(jp, ctxt);
String text = jp.getText().trim(); if (text.length() == 0) { return (Double) getEmptyValue(); return parseDouble(text); } catch (IllegalArgumentException iae) { } throw ctxt.weirdStringException(_valueClass, "not a valid Double value"); return (Double) getNullValue();
return (jp.getIntValue() == 0) ? Boolean.FALSE : Boolean.TRUE; return Boolean.valueOf(_parseBooleanFromNumber(jp, ctxt)); return (Boolean) getNullValue(); return (Boolean) getEmptyValue();
if (rawType == deser.getValueClass()) { return deser; if (deser.getValueClass().isAssignableFrom(rawType)) { return deser;
/** * Method called when a JSON property is encountered that has not matching * setter, any-setter or field, and thus can not be assigned. */ @Override protected void handleUnknownProperty(JsonParser jp, DeserializationContext ctxt, Object beanOrClass, String propName) throws IOException, JsonProcessingException { /* 22-Aug-2010, tatu: Caller now mostly checks for ignorable properties, so * following should not be necessary. However, "handleUnknownProperties()" seems * to still possibly need it so it is left for now. */ // If registered as ignorable, skip if (_ignoreAllUnknown || (_ignorableProps != null && _ignorableProps.contains(propName))) { jp.skipChildren(); return; } /* Otherwise use default handling (call handler(s); if not * handled, throw exception or skip depending on settings) */ super.handleUnknownProperty(jp, ctxt, beanOrClass, propName); }
return parseDouble(text); } catch (IllegalArgumentException iae) { } throw ctxt.weirdStringException(_valueClass, "not a valid double value");
return (jp.getIntValue() != 0); return _parseBooleanFromNumber(jp, ctxt);
protected java.util.Date _parseDate(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonToken t = jp.getCurrentToken(); if (t == JsonToken.VALUE_NUMBER_INT) { return new java.util.Date(jp.getLongValue()); } if (t == JsonToken.VALUE_NULL) { return (java.util.Date) getNullValue(); } if (t == JsonToken.VALUE_STRING) { try { /* As per [JACKSON-203], take empty Strings to mean * null */ String str = jp.getText().trim(); if (str.length() == 0) { return (Date) getEmptyValue(); } return ctxt.parseDate(str); } catch (IllegalArgumentException iae) { throw ctxt.weirdStringException(_valueClass, "not a valid representation (error: "+iae.getMessage()+")"); } } throw ctxt.mappingException(_valueClass, t); }
String text = jp.getText().trim(); if (text.length() == 0) { return (Double) getEmptyValue(); return parseDouble(text); } catch (IllegalArgumentException iae) { } throw ctxt.weirdStringException(_valueClass, "not a valid Double value"); return (Double) getNullValue();
return (jp.getIntValue() == 0) ? Boolean.FALSE : Boolean.TRUE; return Boolean.valueOf(_parseBooleanFromNumber(jp, ctxt)); return (Boolean) getNullValue(); return (Boolean) getEmptyValue();
instanceOrClass = getValueClass(); reportUnknownProperty(ctxt, instanceOrClass, propName);
private void add(StdDeserializer<?> stdDeser, Class<?> valueClass) { // must do some unfortunate casting here... @SuppressWarnings("unchecked") JsonDeserializer<Object> deser = (JsonDeserializer<Object>) stdDeser; // Not super clean, but default TypeFactory does work here: _deserializers.put(new ClassKey(valueClass), deser); } }