@SuppressWarnings("resource") protected Object _deserializeTypedForId(JsonParser p, DeserializationContext ctxt, TokenBuffer tb) throws IOException { String typeId = p.getText(); JsonDeserializer<Object> deser = _findDeserializer(ctxt, typeId); if (_typeIdVisible) { // need to merge id back in JSON input? if (tb == null) { tb = new TokenBuffer(p, ctxt); } tb.writeFieldName(p.getCurrentName()); tb.writeString(typeId); } if (tb != null) { // need to put back skipped properties? // 02-Jul-2016, tatu: Depending on for JsonParserSequence is initialized it may // try to access current token; ensure there isn't one p.clearCurrentToken(); p = JsonParserSequence.createFlattened(false, tb.asParser(p), p); } // Must point to the next value; tb had no current, jp pointed to VALUE_STRING: p.nextToken(); // to skip past String value // deserializer should take care of closing END_OBJECT as well return deser.deserialize(p, ctxt); }
JsonToken t = p.getCurrentToken(); if (t == JsonToken.START_OBJECT) { t = p.nextToken(); } else if (/*t == JsonToken.START_ARRAY ||*/ t != JsonToken.FIELD_NAME) { for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) { String name = p.getCurrentName(); p.nextToken(); // to point to the value if (name.equals(_typePropertyName)) { // gotcha! return _deserializeTypedForId(p, ctxt, tb); tb = new TokenBuffer(p, ctxt); tb.writeFieldName(name); tb.copyCurrentStructure(p);
@Override public void copyCurrentStructure(JsonParser p) throws IOException JsonToken t = p.getCurrentToken(); _checkNativeIds(p); writeFieldName(p.getCurrentName()); t = p.nextToken(); case START_ARRAY: writeStartArray(); while (p.nextToken() != JsonToken.END_ARRAY) { copyCurrentStructure(p); case START_OBJECT: writeStartObject(); while (p.nextToken() != JsonToken.END_OBJECT) { copyCurrentStructure(p);
_checkNativeIds(p); switch (p.getCurrentToken()) { case START_OBJECT: writeStartObject(); break; case FIELD_NAME: writeFieldName(p.getCurrentName()); break; case VALUE_STRING:
case START_ARRAY: if (depth++ == 0) { buffer = new TokenBuffer(Json.mapper, false); buffer.writeFieldName(parser.getCurrentName()); break; case VALUE_NUMBER_INT:
throws IOException JsonToken t = p.getCurrentToken(); if (t == JsonToken.START_OBJECT) { t = p.nextToken(); TokenBuffer tokens = new TokenBuffer(p, ctxt); tokens.writeStartObject(); final Class<?> activeView = _needViewProcesing ? ctxt.getActiveView() : null; for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) { String propName = p.getCurrentName(); SettableBeanProperty prop = _beanProperties.find(propName); p.nextToken(); if (prop != null) { // normal case if (activeView != null && !prop.visibleInView(activeView)) { tokens.writeFieldName(propName); tokens.copyCurrentStructure(p); } else { tokens.writeFieldName(propName); tokens.append(b2); try {
for (JsonToken t = p.getCurrentToken(); t == JsonToken.FIELD_NAME; t = p.nextToken()) { String propName = p.getCurrentName(); SettableBeanProperty prop = _beanProperties.find(propName); p.nextToken(); if (prop != null) { // normal case if (activeView != null && !prop.visibleInView(activeView)) { tokens.writeFieldName(propName); tokens.copyCurrentStructure(p);
return deserializeUsingPropertyBasedWithUnwrapped(p, ctxt); TokenBuffer tokens = new TokenBuffer(p, ctxt); tokens.writeStartObject(); final Object bean = _valueInstantiator.createUsingDefault(ctxt); p.nextToken(); SettableBeanProperty prop = _beanProperties.find(propName); if (prop != null) { // normal case tokens.writeFieldName(propName); tokens.copyCurrentStructure(p); continue; tokens.writeFieldName(propName); tokens.append(b2); try {
@Override public void copyCurrentEvent(JsonParser jp) throws IOException, JsonProcessingException switch (jp.getCurrentToken()) { case START_OBJECT: writeStartObject(); break; case FIELD_NAME: writeFieldName(jp.getCurrentName()); break; case VALUE_STRING:
case START_ARRAY: if (depth++ == 0) { buffer = new TokenBuffer(Json.mapper, false); buffer.writeFieldName(parser.getCurrentName()); break; case VALUE_NUMBER_INT:
JsonToken t = p.getCurrentToken(); if (t == JsonToken.START_OBJECT) { if (p.nextToken() != JsonToken.FIELD_NAME) { ctxt.reportWrongTokenException(baseType(), JsonToken.FIELD_NAME, "need JSON String that contains type id (for subtype of "+baseTypeName()+")"); p.nextToken(); if (_typeIdVisible && p.getCurrentToken() == JsonToken.START_OBJECT) { TokenBuffer tb = new TokenBuffer(null, false); tb.writeFieldName(_typePropertyName); tb.writeString(typeId); p.nextToken();
@Override public void copyCurrentStructure(JsonParser jp) throws IOException, JsonProcessingException { JsonToken t = jp.getCurrentToken(); // Let's handle field-name separately first if (t == JsonToken.FIELD_NAME) { writeFieldName(jp.getCurrentName()); t = jp.nextToken(); // fall-through to copy the associated value } switch (t) { case START_ARRAY: writeStartArray(); while (jp.nextToken() != JsonToken.END_ARRAY) { copyCurrentStructure(jp); } writeEndArray(); break; case START_OBJECT: writeStartObject(); while (jp.nextToken() != JsonToken.END_OBJECT) { copyCurrentStructure(jp); } writeEndObject(); break; default: // others are simple: copyCurrentEvent(jp); } }
@SuppressWarnings("resource") protected final Object _deserializeTypedForId(JsonParser jp, DeserializationContext ctxt, TokenBuffer tb) throws IOException { String typeId = jp.getText(); JsonDeserializer<Object> deser = _findDeserializer(ctxt, typeId); if (_typeIdVisible) { // need to merge id back in JSON input? if (tb == null) { tb = new TokenBuffer(null, false); } tb.writeFieldName(jp.getCurrentName()); tb.writeString(typeId); } if (tb != null) { // need to put back skipped properties? jp = JsonParserSequence.createFlattened(tb.asParser(jp), jp); } // Must point to the next value; tb had no current, jp pointed to VALUE_STRING: jp.nextToken(); // to skip past String value // deserializer should take care of closing END_OBJECT as well return deser.deserialize(jp, ctxt); }
@Override public void copyCurrentEvent(JsonParser jp) throws IOException, JsonProcessingException switch (jp.getCurrentToken()) { case START_OBJECT: writeStartObject(); break; case FIELD_NAME: writeFieldName(jp.getCurrentName()); break; case VALUE_STRING:
return deserializeUsingPropertyBasedWithUnwrapped(p, ctxt); TokenBuffer tokens = new TokenBuffer(p, ctxt); tokens.writeStartObject(); Object bean = _valueInstantiator.createUsingDefault(ctxt); for (; p.getCurrentToken() == JsonToken.FIELD_NAME; p.nextToken()) { String propName = p.getCurrentName(); p.nextToken(); SettableBeanProperty prop = _beanProperties.find(propName); if (prop != null) { // normal case tokens.writeFieldName(propName); tokens.copyCurrentStructure(p);
@Override public void copyCurrentStructure(JsonParser jp) throws IOException, JsonProcessingException { JsonToken t = jp.getCurrentToken(); // Let's handle field-name separately first if (t == JsonToken.FIELD_NAME) { writeFieldName(jp.getCurrentName()); t = jp.nextToken(); // fall-through to copy the associated value } switch (t) { case START_ARRAY: writeStartArray(); while (jp.nextToken() != JsonToken.END_ARRAY) { copyCurrentStructure(jp); } writeEndArray(); break; case START_OBJECT: writeStartObject(); while (jp.nextToken() != JsonToken.END_OBJECT) { copyCurrentStructure(jp); } writeEndObject(); break; default: // others are simple: copyCurrentEvent(jp); } }
@SuppressWarnings("resource") protected final Object _deserializeTypedForId(JsonParser jp, DeserializationContext ctxt, TokenBuffer tb) throws IOException { String typeId = jp.getText(); JsonDeserializer<Object> deser = _findDeserializer(ctxt, typeId); if (_typeIdVisible) { // need to merge id back in JSON input? if (tb == null) { tb = new TokenBuffer(null, false); } tb.writeFieldName(jp.getCurrentName()); tb.writeString(typeId); } if (tb != null) { // need to put back skipped properties? jp = JsonParserSequence.createFlattened(tb.asParser(jp), jp); } // Must point to the next value; tb had no current, jp pointed to VALUE_STRING: jp.nextToken(); // to skip past String value // deserializer should take care of closing END_OBJECT as well return deser.deserialize(jp, ctxt); }
_checkNativeIds(jp); switch (jp.getCurrentToken()) { case START_OBJECT: writeStartObject(); break; case FIELD_NAME: writeFieldName(jp.getCurrentName()); break; case VALUE_STRING:
protected Object _deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { if (jp.canReadTypeId()) { Object typeId = jp.getTypeId(); if (typeId != null) { return _deserializeWithNativeTypeId(jp, ctxt, typeId); } } String typeId = _locateTypeId(jp, ctxt); JsonDeserializer<Object> deser = _findDeserializer(ctxt, typeId); if (_typeIdVisible && !_usesExternalId() && jp.getCurrentToken() == JsonToken.START_OBJECT) { TokenBuffer tb = new TokenBuffer(null, false); tb.writeStartObject(); tb.writeFieldName(_typePropertyName); tb.writeString(typeId); jp = JsonParserSequence.createFlattened(false, tb.asParser(jp), jp); jp.nextToken(); } Object value = deser.deserialize(jp, ctxt); return value; } }
@Override public void copyCurrentStructure(JsonParser jp) throws IOException, JsonProcessingException JsonToken t = jp.getCurrentToken(); _checkNativeIds(jp); writeFieldName(jp.getCurrentName()); t = jp.nextToken(); case START_ARRAY: writeStartArray(); while (jp.nextToken() != JsonToken.END_ARRAY) { copyCurrentStructure(jp); case START_OBJECT: writeStartObject(); while (jp.nextToken() != JsonToken.END_OBJECT) { copyCurrentStructure(jp);