protected Object mapArray(JsonParser p, DeserializationContext ctxt, Collection<Object> result) throws IOException { // we start by pointing to START_ARRAY. Also, no real merging; array/Collection // just appends always while (p.nextToken() != JsonToken.END_ARRAY) { result.add(deserialize(p, ctxt)); } return result; }
@Override /** * All joynr objects are serialized with type information, so deserialize them as such */ public Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonToken t = jp.getCurrentToken(); if (t == JsonToken.START_OBJECT) { return super.deserializeWithType(jp, ctxt, typeDeserializer); } return super.deserialize(jp, ctxt); } }
protected Object mapObject(JsonParser p, DeserializationContext ctxt, Map<Object,Object> m) throws IOException { JsonToken t = p.getCurrentToken(); if (t == JsonToken.START_OBJECT) { t = p.nextToken(); } if (t == JsonToken.END_OBJECT) { return m; } // NOTE: we are guaranteed to point to FIELD_NAME String key = p.getCurrentName(); do { p.nextToken(); // and possibly recursive merge here Object old = m.get(key); Object newV; if (old != null) { newV = deserialize(p, ctxt, old); } else { newV = deserialize(p, ctxt); } if (newV != old) { m.put(key, newV); } } while ((key = p.nextFieldName()) != null); return m; }
@Override /** * Arrays are not serialized with type information, so also need to deserialize them without */ public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer withTypeDeserializer) throws IOException, JsonProcessingException { JsonToken t = jp.getCurrentToken(); if (t == JsonToken.START_ARRAY) { return super.deserialize(jp, ctxt); } return super.deserializeWithType(jp, ctxt, withTypeDeserializer); }
return new ArrayList<Object>(2); Object value = deserialize(p, ctxt); if (p.nextToken() == JsonToken.END_ARRAY) { ArrayList<Object> l = new ArrayList<Object>(2); return l; Object value2 = deserialize(p, ctxt); if (p.nextToken() == JsonToken.END_ARRAY) { ArrayList<Object> l = new ArrayList<Object>(2); int totalSize = ptr; do { value = deserialize(p, ctxt); ++totalSize; if (ptr >= values.length) {
Object value1 = deserialize(p, ctxt); Object value2 = deserialize(p, ctxt); result.put(key, deserialize(p, ctxt)); } while ((key = p.nextFieldName()) != null); return result;
/** * Method called to map a JSON Array into a Java Object array (Object[]). */ protected Object[] mapArrayToArray(JsonParser p, DeserializationContext ctxt) throws IOException { // Minor optimization to handle small lists (default size for ArrayList is 10) if (p.nextToken() == JsonToken.END_ARRAY) { return NO_OBJECTS; } ObjectBuffer buffer = ctxt.leaseObjectBuffer(); Object[] values = buffer.resetAndStart(); int ptr = 0; do { Object value = deserialize(p, ctxt); if (ptr >= values.length) { values = buffer.appendCompletedChunk(values); ptr = 0; } values[ptr++] = value; } while (p.nextToken() != JsonToken.END_ARRAY); return buffer.completeAndClearBuffer(values, ptr); }
return deserialize(p, ctxt); return deserialize(p, ctxt);
protected Object mapArray(JsonParser p, DeserializationContext ctxt, Collection<Object> result) throws IOException { // we start by pointing to START_ARRAY. Also, no real merging; array/Collection // just appends always while (p.nextToken() != JsonToken.END_ARRAY) { result.add(deserialize(p, ctxt)); } return result; }
protected Object mapObject(JsonParser p, DeserializationContext ctxt, Map<Object,Object> m) throws IOException { JsonToken t = p.getCurrentToken(); if (t == JsonToken.START_OBJECT) { t = p.nextToken(); } if (t == JsonToken.END_OBJECT) { return m; } // NOTE: we are guaranteed to point to FIELD_NAME String key = p.getCurrentName(); do { p.nextToken(); // and possibly recursive merge here Object old = m.get(key); Object newV; if (old != null) { newV = deserialize(p, ctxt, old); } else { newV = deserialize(p, ctxt); } if (newV != old) { m.put(key, newV); } } while ((key = p.nextFieldName()) != null); return m; }
return new ArrayList<Object>(2); Object value = deserialize(jp, ctxt); if (jp.nextToken() == JsonToken.END_ARRAY) { ArrayList<Object> l = new ArrayList<Object>(2); return l; Object value2 = deserialize(jp, ctxt); if (jp.nextToken() == JsonToken.END_ARRAY) { ArrayList<Object> l = new ArrayList<Object>(2); int totalSize = ptr; do { value = deserialize(jp, ctxt); ++totalSize; if (ptr >= values.length) {
/** * Method called to map a JSON Array into a Java Object array (Object[]). */ protected Object[] mapArrayToArray(JsonParser jp, DeserializationContext ctxt) throws IOException { // Minor optimization to handle small lists (default size for ArrayList is 10) if (jp.nextToken() == JsonToken.END_ARRAY) { return NO_OBJECTS; } ObjectBuffer buffer = ctxt.leaseObjectBuffer(); Object[] values = buffer.resetAndStart(); int ptr = 0; do { Object value = deserialize(jp, ctxt); if (ptr >= values.length) { values = buffer.appendCompletedChunk(values); ptr = 0; } values[ptr++] = value; } while (jp.nextToken() != JsonToken.END_ARRAY); return buffer.completeAndClearBuffer(values, ptr); }
/** * Method called to map a JSON Array into a Java Object array (Object[]). */ protected Object[] mapArrayToArray(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { // Minor optimization to handle small lists (default size for ArrayList is 10) if (jp.nextToken() == JsonToken.END_ARRAY) { return NO_OBJECTS; } ObjectBuffer buffer = ctxt.leaseObjectBuffer(); Object[] values = buffer.resetAndStart(); int ptr = 0; do { Object value = deserialize(jp, ctxt); if (ptr >= values.length) { values = buffer.appendCompletedChunk(values); ptr = 0; } values[ptr++] = value; } while (jp.nextToken() != JsonToken.END_ARRAY); return buffer.completeAndClearBuffer(values, ptr); } }
/** * Method called to map a JSON Array into a Java Object array (Object[]). */ protected Object[] mapArrayToArray(JsonParser jp, DeserializationContext ctxt) throws IOException { // Minor optimization to handle small lists (default size for ArrayList is 10) if (jp.nextToken() == JsonToken.END_ARRAY) { return NO_OBJECTS; } ObjectBuffer buffer = ctxt.leaseObjectBuffer(); Object[] values = buffer.resetAndStart(); int ptr = 0; do { Object value = deserialize(jp, ctxt); if (ptr >= values.length) { values = buffer.appendCompletedChunk(values); ptr = 0; } values[ptr++] = value; } while (jp.nextToken() != JsonToken.END_ARRAY); return buffer.completeAndClearBuffer(values, ptr); }
/** * Method called to map a JSON Array into a Java Object array (Object[]). */ protected Object[] mapArrayToArray(JsonParser p, DeserializationContext ctxt) throws IOException { // Minor optimization to handle small lists (default size for ArrayList is 10) if (p.nextToken() == JsonToken.END_ARRAY) { return NO_OBJECTS; } ObjectBuffer buffer = ctxt.leaseObjectBuffer(); Object[] values = buffer.resetAndStart(); int ptr = 0; do { Object value = deserialize(p, ctxt); if (ptr >= values.length) { values = buffer.appendCompletedChunk(values); ptr = 0; } values[ptr++] = value; } while (p.nextToken() != JsonToken.END_ARRAY); return buffer.completeAndClearBuffer(values, ptr); }
/** * Method called to map a JSON Array into a Java Object array (Object[]). */ protected Object[] mapArrayToArray(JsonParser p, DeserializationContext ctxt) throws IOException { // Minor optimization to handle small lists (default size for ArrayList is 10) if (p.nextToken() == JsonToken.END_ARRAY) { return NO_OBJECTS; } ObjectBuffer buffer = ctxt.leaseObjectBuffer(); Object[] values = buffer.resetAndStart(); int ptr = 0; do { Object value = deserialize(p, ctxt); if (ptr >= values.length) { values = buffer.appendCompletedChunk(values); ptr = 0; } values[ptr++] = value; } while (p.nextToken() != JsonToken.END_ARRAY); return buffer.completeAndClearBuffer(values, ptr); }
/** * Method called to map a JSON Array into a Java Object array (Object[]). */ protected Object[] mapArrayToArray(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { // Minor optimization to handle small lists (default size for ArrayList is 10) if (jp.nextToken() == JsonToken.END_ARRAY) { return NO_OBJECTS; } ObjectBuffer buffer = ctxt.leaseObjectBuffer(); Object[] values = buffer.resetAndStart(); int ptr = 0; do { Object value = deserialize(jp, ctxt); if (ptr >= values.length) { values = buffer.appendCompletedChunk(values); ptr = 0; } values[ptr++] = value; } while (jp.nextToken() != JsonToken.END_ARRAY); return buffer.completeAndClearBuffer(values, ptr); } }
int totalSize = 0; do { Object value = deserialize(jp, ctxt); ++totalSize; if (ptr >= values.length) {
@Override public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { // Make sure we have a native type ID *AND* that we can resolve it to a type; otherwise, we'll end up in a recursive loop if (p.canReadTypeId()) { Object typeId = p.getTypeId(); if (typeId != null) { if (_typeDeserializer != null) { TypeIdResolver resolver = _typeDeserializer.getTypeIdResolver(); if (resolver != null && resolver.typeFromId(ctxt, typeId.toString()) != null) { return _typeDeserializer.deserializeTypedFromAny(p, ctxt); } } } } return super.deserialize(p, ctxt); }
int totalSize = 0; do { Object value = deserialize(jp, ctxt); ++totalSize; if (ptr >= values.length) {