Java Code Examples for com.fasterxml.jackson.databind.JsonDeserializer#deserialize()

The following examples show how to use com.fasterxml.jackson.databind.JsonDeserializer#deserialize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TupleDeserializer.java    From vavr-jackson with Apache License 2.0 6 votes vote down vote up
@Override
public T deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
    List<Object> list = new ArrayList<>();
    int ptr = 0;

    for (JsonToken jsonToken = p.nextToken(); jsonToken != END_ARRAY; jsonToken = p.nextToken()) {
        if (ptr >= deserializersCount()) {
            throw mappingException(ctxt, javaType.getRawClass(), jsonToken);
        }
        JsonDeserializer<?> deserializer = deserializer(ptr++);
        Object value = (jsonToken != VALUE_NULL) ? deserializer.deserialize(p, ctxt) : deserializer.getNullValue(ctxt);
        list.add(value);
    }
    if (list.size() == deserializersCount()) {
        return create(list, ctxt);
    } else {
        throw mappingException(ctxt, javaType.getRawClass(), null);
    }
}
 
Example 2
Source File: LazyEither5Deserializer.java    From cyclops with Apache License 2.0 6 votes vote down vote up
@Override
public LazyEither5<?,?,?,?,?> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
  JsonDeserializer ser = ctxt.findRootValueDeserializer(ctxt.getTypeFactory().constructSimpleType(LazyEitherBean.class, new JavaType[0]));
  LazyEitherBean x = (LazyEitherBean)ser.deserialize(p, ctxt);
  if(x.left1!=null){
    return LazyEither5.left1(x.left1);
  }
  if(x.left2!=null){
    return LazyEither5.left2(x.left2);
  }
  if(x.left3!=null){
    return LazyEither5.left3(x.left2);
  }
  if(x.left4!=null){
    return LazyEither5.left4(x.left2);
  }
  return LazyEither5.right(x.right);
}
 
Example 3
Source File: TypeDeserializerBase.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Helper method called when {@link JsonParser} indicates that it can use
 * so-called native type ids, and such type id has been found.
 * 
 * @since 2.4
 */
protected Object _deserializeWithNativeTypeId(JsonParser jp, DeserializationContext ctxt, Object typeId)
    throws IOException
{
    JsonDeserializer<Object> deser;
    if (typeId == null) {
        /* 04-May-2014, tatu: Should error be obligatory, or should there be another method
         *   for "try to deserialize with native tpye id"?
         */
        deser = _findDefaultImplDeserializer(ctxt);
        if (deser == null) {
            return ctxt.reportInputMismatch(baseType(),
                    "No (native) type id found when one was expected for polymorphic type handling");
        }
    } else {
        String typeIdStr = (typeId instanceof String) ? (String) typeId : String.valueOf(typeId);
        deser = _findDeserializer(ctxt, typeIdStr);
    }
    return deser.deserialize(jp, ctxt);
}
 
Example 4
Source File: GuavaMultisetDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 6 votes vote down vote up
@Override
protected T _deserializeContents(JsonParser p, DeserializationContext ctxt) throws IOException,
        JsonProcessingException {
    JsonDeserializer<?> valueDes = _valueDeserializer;
    JsonToken t;
    final TypeDeserializer typeDeser = _valueTypeDeserializer;
    T set = createMultiset();

    while ((t = p.nextToken()) != JsonToken.END_ARRAY) {
        Object value;

        if (t == JsonToken.VALUE_NULL) {
            if (_skipNullValues) {
                continue;
            }
            value = _nullProvider.getNullValue(ctxt);
        } else if (typeDeser == null) {
            value = valueDes.deserialize(p, ctxt);
        } else {
            value = valueDes.deserializeWithType(p, ctxt, typeDeser);
        }
        set.add(value);
    }
    return set;
}
 
Example 5
Source File: PersistentMapDeserializer.java    From cyclops with Apache License 2.0 6 votes vote down vote up
@Override
public PersistentMap<?, ?> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
  JsonDeserializer deser = ctxt.findRootValueDeserializer(ctxt.getTypeFactory().constructRawMapType(Map.class));

  Object o = deser.deserialize(p, ctxt);
  if(HashMap.class.isAssignableFrom(mapType))
    return HashMap.fromMap((Map)o);
  if(TreeMap.class.isAssignableFrom(mapType))
    return TreeMap.fromMap((Comparator)Comparator.naturalOrder(),(Map)o);

 /** if(TrieMap.class.isAssignableFrom(mapType))
    return TrieMap.fromMap((Map)o);
  if(LinkedMap.class.isAssignableFrom(mapType))
    return LinkedMap.fromMap((Map)o);
  **/
  Optional<Method> m = streamMethod.computeIfAbsent(mapType, c-> Stream.of(c.getMethods())
    .filter(method -> "fromMap".equals(method.getName()))
    .filter(method -> method.getParameterCount()==1)
    .filter(method -> method.getParameterTypes()[0].isAssignableFrom(Map.class)).findFirst()
    .map(m2->{ m2.setAccessible(true); return m2;}));
  PersistentMap<?,?> x = m.map(mt -> (PersistentMap)new  Invoker().executeMethod(o, mt, mapType)).orElse(null);

  return x;

}
 
Example 6
Source File: StdCallbackContext.java    From cloudformation-cli-java-plugin with Apache License 2.0 5 votes vote down vote up
private Object readEncoded(JsonParser p, DeserializationContext ctxt) throws IOException {
    if (!p.isExpectedStartArrayToken()) {
        throw new JsonParseException(p, "Expected array for encoded object got " + p.currentToken());
    }

    Object value = null;
    JsonToken next = p.nextToken();
    if (next != JsonToken.VALUE_STRING) {
        throw new JsonParseException(p, "Encoded Class value not present " + next);
    }
    String typeName = p.getText();
    p.nextToken(); // fwd to next
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
    if (loader == null) {
        loader = getClass().getClassLoader();
    }
    try {
        Class<?> type = loader.loadClass(typeName);
        if (Collection.class.isAssignableFrom(type)) {
            value = readCollection(type, p, ctxt);
        } else if (Map.class.isAssignableFrom(type)) {
            value = readMap(type, p, ctxt);
        } else {
            JsonDeserializer<Object> deser = ctxt.findRootValueDeserializer(ctxt.constructType(type));
            value = deser.deserialize(p, ctxt);
        }
    } catch (ClassNotFoundException e) {
        throw new JsonParseException(p, "Type name encoded " + typeName + " could not be loaded", e);
    }
    if (p.nextToken() != JsonToken.END_ARRAY) {
        throw new JsonParseException(p, "Encoded expected end of ARRAY marker " + p.currentToken());
    }
    return value;
}
 
Example 7
Source File: LazyEither4Deserializer.java    From cyclops with Apache License 2.0 5 votes vote down vote up
@Override
public LazyEither4<?,?,?,?> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
  JsonDeserializer ser = ctxt.findRootValueDeserializer(ctxt.getTypeFactory().constructSimpleType(LazyEitherBean.class, new JavaType[0]));
  LazyEitherBean x = (LazyEitherBean)ser.deserialize(p, ctxt);
  if(x.left1!=null){
    return LazyEither4.left1(x.left1);
  }
  if(x.left2!=null){
    return LazyEither4.left2(x.left2);
  }
  if(x.left3!=null){
    return LazyEither4.left3(x.left2);
  }
  return LazyEither4.right(x.right);
}
 
Example 8
Source File: ValueProvider.java    From beam with Apache License 2.0 5 votes vote down vote up
@Override
public ValueProvider<?> deserialize(JsonParser jp, DeserializationContext ctxt)
    throws IOException, JsonProcessingException {
  JsonDeserializer dser =
      ctxt.findRootValueDeserializer(
          checkNotNull(
              innerType, "Invalid %s: innerType is null. Serialization error?", getClass()));
  Object o = dser.deserialize(jp, ctxt);
  return StaticValueProvider.of(o);
}
 
Example 9
Source File: JobParametersDeserializer.java    From haven-platform with Apache License 2.0 5 votes vote down vote up
@Override
public Object deserialize(JsonParser p, DeserializationContext ctx) throws IOException {
    if(jobsManager == null) {
        throw new IllegalStateException("This deserializer need a jobsManager instance, see 'JobParametersDeserializer.setJobsManager'");
    }
    final JsonStreamContext jsc = p.getParsingContext();
    String paramName = null;
    JsonStreamContext parent = jsc;
    while(parent != null) {
        paramName = parent.getCurrentName();
        if(paramName != null) {
            break;
        }
        parent = parent.getParent();
    }
    if(parent == null) {
        throw new NullPointerException("Something wrong: we can not find our parent object, " +
          "may be you use this deserializer on custom object?");
    }
    JobParameters.Builder r = (JobParameters.Builder) parent.getParent().getCurrentValue();
    String jobType = r.getType();
    JobDescription desc = jobsManager.getDescription(jobType);
    JobParameterDescription param = desc.getParameters().get(paramName);
    TypeFactory typeFactory = ctx.getTypeFactory();
    JavaType type;
    if(param == null) {
        type = typeFactory.constructType(Object.class);
    } else {
        type = typeFactory.constructType(param.getType());
    }
    JsonDeserializer<Object> deser = ctx.findNonContextualValueDeserializer(type);
    try {
        return deser.deserialize(p, ctx);
    } catch (Exception e) {
        throw new RuntimeException("Can not deserialize '" + jobType + "." + paramName + "' job parameter ", e );
    }
}
 
Example 10
Source File: HiveProxyingSubScanDeserializer.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public HiveProxyingSubScan deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
  final JsonNode node = jsonParser.getCodec().readTree(jsonParser);

  final String pluginName = node.get("pluginName").asText();
  final CatalogService catalogService = (CatalogService) deserializationContext
    .findInjectableValue(CatalogService.class.getName(), null, null);

  final StoragePluginCreator.PF4JStoragePlugin plugin = catalogService.getSource(pluginName);
  final Class<? extends HiveProxiedSubScan> scanClazz = plugin.getSubScanClass();

  final JavaType scanType = deserializationContext.getTypeFactory().constructType(scanClazz);
  final BasicBeanDescription description = deserializationContext.getConfig().introspect(scanType);
  final JsonDeserializer<Object> subScanDeserializer = deserializationContext.getFactory().createBeanDeserializer(
    deserializationContext, scanType, description);

  if (subScanDeserializer instanceof ResolvableDeserializer) {
    ((ResolvableDeserializer) subScanDeserializer).resolve(deserializationContext);
  }

  final JsonParser movedParser = jsonParser.getCodec().treeAsTokens(node.get("wrappedHiveScan"));
  deserializationContext.getConfig().initialize(movedParser);

  if (movedParser.getCurrentToken() == null) {
    movedParser.nextToken();
  }

  final HiveProxiedSubScan scan = (HiveProxiedSubScan) subScanDeserializer.deserialize(movedParser, deserializationContext);
  return new HiveProxyingSubScan(pluginName, scan);
}
 
Example 11
Source File: LazyEitherDeserializer.java    From cyclops with Apache License 2.0 5 votes vote down vote up
@Override
public LazyEither<?,?> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
  JsonDeserializer ser = ctxt.findRootValueDeserializer(ctxt.getTypeFactory().constructSimpleType(LazyEitherBean.class, new JavaType[0]));
  LazyEitherBean x = (LazyEitherBean)ser.deserialize(p, ctxt);
  if(x.left!=null){
    return LazyEither.left(x.left);
  }
  return LazyEither.right(x.right);
}
 
Example 12
Source File: CustomCollectionDeserializer.java    From caravan with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method called when current token is no START_ARRAY. Will either
 * throw an exception, or try to handle value as if member of implicit
 * array, depending on configuration.
 */
@SuppressWarnings("unchecked")
protected final Collection<Object> handleNonArray(JsonParser p, DeserializationContext ctxt,
    Collection<Object> result)
    throws IOException {
  // Implicit arrays from single values?
  boolean canWrap = (_unwrapSingle == Boolean.TRUE) ||
      ((_unwrapSingle == null) &&
          ctxt.isEnabled(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY));
  if (!canWrap) {
    return (Collection<Object>) ctxt.handleUnexpectedToken(_containerType.getRawClass(), p);
  }
  JsonDeserializer<Object> valueDes = _valueDeserializer;
  final TypeDeserializer typeDeser = _valueTypeDeserializer;
  JsonToken t = p.getCurrentToken();

  Object value;

  try {
    if (t == JsonToken.VALUE_NULL) {
      // 03-Feb-2017, tatu: Hmmh. I wonder... let's try skipping here, too
      if (_skipNullValues) {
        return result;
      }
      value = _nullProvider.getNullValue(ctxt);
    } else if (typeDeser == null) {
      value = valueDes.deserialize(p, ctxt);
    } else {
      value = valueDes.deserializeWithType(p, ctxt, typeDeser);
    }
  } catch (Exception e) {
    // note: pass Object.class, not Object[].class, as we need element type for error info
    throw JsonMappingException.wrapWithPath(e, Object.class, result.size());
  }
  result.add(value);
  return result;
}
 
Example 13
Source File: LazyEither3Deserializer.java    From cyclops with Apache License 2.0 5 votes vote down vote up
@Override
public LazyEither3<?,?,?> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
  JsonDeserializer ser = ctxt.findRootValueDeserializer(ctxt.getTypeFactory().constructSimpleType(LazyEitherBean.class, new JavaType[0]));
  LazyEitherBean x = (LazyEitherBean)ser.deserialize(p, ctxt);
  if(x.left1!=null){
    return LazyEither3.left1(x.left1);
  }
  if(x.left2!=null){
    return LazyEither3.left2(x.left2);
  }
  return LazyEither3.right(x.right);
}
 
Example 14
Source File: JsonDeviceRenderTypeMap.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected DeviceRenderTypeMap readValue( JsonParser jsonParser )
{
    try
    {
        JsonDeserializer<DeviceRenderTypeMap> jsonDeserializer = deserializer.newInstance();
        return jsonDeserializer.deserialize( jsonParser, MAPPER.getDeserializationContext() );
    }
    catch ( IOException | IllegalAccessException | InstantiationException e )
    {
        throw new RuntimeException( e );
    }
}
 
Example 15
Source File: BulkResultDeserializer.java    From log4j2-elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
    int took = 0;
    boolean errors = false;
    BulkError error = null;
    int status = -1;
    List<BulkResultItem> items = null;

    String fieldName;
    while ((fieldName = p.nextFieldName()) != null)  {
        switch (fieldName) {
            case "took": {
                took = p.nextIntValue(-1);
                break;
            }
            case "errors": {
                errors = p.nextBooleanValue();
                break;
            }
            case "status": {
                status = p.nextIntValue(-1);
                break;
            }
            case "error": {
                p.nextValue(); // skip to START_OBJECT or VALUE_NULL
                JsonDeserializer<Object> typeDeserializer = ctxt.findNonContextualValueDeserializer(ctxt.constructType(BulkError.class));
                error = (BulkError) typeDeserializer.deserialize(p, ctxt);
                break;
            }
            case "items": {
                if (errors) {
                    items = new ArrayList<>();
                    p.nextValue(); // skip to START_ARRAY
                    p.nextValue(); // skip to START_OBJECT
                    ObjectMapper mapper = (ObjectMapper) p.getCodec();
                    MappingIterator<BulkResultItem> bulkResultItemMappingIterator = mapper.readValues(p, BulkResultItem.class);

                    while (bulkResultItemMappingIterator.hasNext()) {
                        items.add(bulkResultItemMappingIterator.next());
                    }
                }
                break;
            }
        }
    }

    return new BufferedBulkResult(took, errors, error, status, items);
}
 
Example 16
Source File: BatchResultDeserializer.java    From log4j2-elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
    int took = 0;
    boolean errors = false;
    Error error = null;
    int status = -1;
    List<BatchItemResult> items = null;

    String fieldName;
    while ((fieldName = p.nextFieldName()) != null)  {
        switch (fieldName) {
            case "took": {
                took = p.nextIntValue(-1);
                break;
            }
            case "errors": {
                errors = p.nextBooleanValue();
                break;
            }
            case "status": {
                status = p.nextIntValue(-1);
                break;
            }
            case "error": {
                p.nextValue(); // skip to START_OBJECT or VALUE_NULL
                JsonDeserializer<Object> typeDeserializer = ctxt.findNonContextualValueDeserializer(ctxt.constructType(Error.class));
                error = (Error) typeDeserializer.deserialize(p, ctxt);
                break;
            }
            case "items": {
                if (errors) {
                    items = new ArrayList<>();
                    p.nextValue(); // skip to START_ARRAY
                    p.nextValue(); // skip to START_OBJECT
                    ObjectMapper mapper = (ObjectMapper) p.getCodec();
                    MappingIterator<BatchItemResult> batchResultItemMappingIterator = mapper.readValues(p, BatchItemResult.class);

                    while (batchResultItemMappingIterator.hasNext()) {
                        items.add(batchResultItemMappingIterator.next());
                    }
                }
                break;
            }
        }
    }

    return new BatchResult(took, errors, error, status, items);
}
 
Example 17
Source File: GuavaImmutableMapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 4 votes vote down vote up
@Override
protected T _deserializeEntries(JsonParser p, DeserializationContext ctxt)
    throws IOException, JsonProcessingException
{
    final KeyDeserializer keyDes = _keyDeserializer;
    final JsonDeserializer<?> valueDes = _valueDeserializer;
    final TypeDeserializer typeDeser = _valueTypeDeserializer;

    ImmutableMap.Builder<Object, Object> builder = createBuilder();
    for (; p.currentToken() == JsonToken.FIELD_NAME; p.nextToken()) {
        // Must point to field name now
        String fieldName = p.currentName();
        Object key = (keyDes == null) ? fieldName : keyDes.deserializeKey(fieldName, ctxt);
        // And then the value...
        JsonToken t = p.nextToken();
        // 28-Nov-2010, tatu: Should probably support "ignorable properties" in future...
        Object value;            
        if (t == JsonToken.VALUE_NULL) {
            if (!_skipNullValues) {
                value = _nullProvider.getNullValue(ctxt);
                // 14-Sep-2015, tatu: As per [datatype-guava#52], avoid exception due to null
                // TODO: allow reporting problem via a feature, in future?
                if (value != null) {
                    builder.put(key, value);
                }
            }
            continue;
        }
        if (typeDeser == null) {
            value = valueDes.deserialize(p, ctxt);
        } else {
            value = valueDes.deserializeWithType(p, ctxt, typeDeser);
        }
        builder.put(key, value);
    }
    // No class outside of the package will be able to subclass us,
    // and we provide the proper builder for the subclasses we implement.
    @SuppressWarnings("unchecked")
    T map = (T) builder.build();
    return map;
}
 
Example 18
Source File: SerializableDeserializer.java    From vavr-jackson with Apache License 2.0 4 votes vote down vote up
@Override
public T deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
    JsonDeserializer<Object> deserializer = ctxt.findRootValueDeserializer(ctxt.constructType(byte[].class));
    byte[] bytes = (byte[]) deserializer.deserialize(p, ctxt);
    return deserialize(bytes);
}
 
Example 19
Source File: ListDeserializer.java    From allure2 with Apache License 2.0 4 votes vote down vote up
@Override
public Collection<Object> deserialize(JsonParser p, DeserializationContext ctxt,
                                      Collection<Object> result)
        throws IOException {
    // Ok: must point to START_ARRAY (or equivalent)
    if (!p.isExpectedStartArrayToken()) {
        return result;
    }
    // [databind#631]: Assign current value, to be accessible by custom serializers
    p.setCurrentValue(result);

    JsonDeserializer<Object> valueDes = _valueDeserializer;
    final TypeDeserializer typeDeser = _valueTypeDeserializer;
    CollectionReferringAccumulator referringAccumulator =
            (valueDes.getObjectIdReader() == null) ? null :
                    new CollectionReferringAccumulator(_containerType.getContentType().getRawClass(), result);

    JsonToken t;
    while ((t = p.nextToken()) != JsonToken.END_ARRAY) {
        try {
            Object value;
            if (t == JsonToken.VALUE_NULL) {
                if (_skipNullValues) {
                    continue;
                }
                value = _nullProvider.getNullValue(ctxt);
            } else if (typeDeser == null) {
                value = valueDes.deserialize(p, ctxt);
            } else {
                value = valueDes.deserializeWithType(p, ctxt, typeDeser);
            }
            if (referringAccumulator != null) {
                referringAccumulator.add(value);
            } else {
                result.add(value);
            }
        } catch (UnresolvedForwardReference reference) {
            if (referringAccumulator == null) {
                throw JsonMappingException
                        .from(p, "Unresolved forward reference but no identity info", reference);
            }
            ReadableObjectId.Referring ref = referringAccumulator.handleUnresolvedReference(reference);
            reference.getRoid().appendReferring(ref);
        } catch (Exception e) {
            boolean wrap = (ctxt == null) || ctxt.isEnabled(DeserializationFeature.WRAP_EXCEPTIONS);
            if (!wrap) {
                ClassUtil.throwIfRTE(e);
            }
            throw JsonMappingException.wrapWithPath(e, result, result.size());
        }
    }
    return result;
}
 
Example 20
Source File: CustomCollectionDeserializer.java    From caravan with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public Object deserialize(JsonParser p, DeserializationContext ctxt,
    Object result)
    throws IOException {
  // Ok: must point to START_ARRAY (or equivalent)
  if (!p.isExpectedStartArrayToken()) {
    return handleNonArray(p, ctxt, (Collection<Object>) result);
  }
  // [databind#631]: Assign current value, to be accessible by custom serializers
  p.setCurrentValue(result);

  JsonDeserializer<Object> valueDes = _valueDeserializer;
  final TypeDeserializer typeDeser = _valueTypeDeserializer;
  CollectionReferringAccumulator referringAccumulator =
      (valueDes.getObjectIdReader() == null) ? null :
          new CollectionReferringAccumulator(_containerType.getContentType().getRawClass(), (Collection<Object>) result);

  JsonToken t;
  while ((t = p.nextToken()) != JsonToken.END_ARRAY) {
    try {
      Object value;
      if (t == JsonToken.VALUE_NULL) {
        if (_skipNullValues) {
          continue;
        }
        value = _nullProvider.getNullValue(ctxt);
      } else if (typeDeser == null) {
        value = valueDes.deserialize(p, ctxt);
      } else {
        value = valueDes.deserializeWithType(p, ctxt, typeDeser);
      }
      if (referringAccumulator != null) {
        referringAccumulator.add(value);
      } else {
        ((Collection<Object>) result).add(value);
      }
    } catch (UnresolvedForwardReference reference) {
      if (referringAccumulator == null) {
        throw JsonMappingException
            .from(p, "Unresolved forward reference but no identity info", reference);
      }
      Referring ref = referringAccumulator.handleUnresolvedReference(reference);
      reference.getRoid().appendReferring(ref);
    } catch (Exception e) {
      boolean wrap = (ctxt == null) || ctxt.isEnabled(DeserializationFeature.WRAP_EXCEPTIONS);
      if (!wrap) {
        ClassUtil.throwIfRTE(e);
      }
      throw JsonMappingException.wrapWithPath(e, result, ((Collection<Object>) result).size());
    }
  }
  return result;
}