com.sap.cds.adapter.odata.v2.utils.ExpandItemTreeBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cds-adapter-odata-v2 Show documentation
Show all versions of cds-adapter-odata-v2 Show documentation
OData V2 adapter for CDS Services Java
/**************************************************************************
* (C) 2019-2024 SAP SE or an SAP affiliate company. All rights reserved. *
**************************************************************************/
package com.sap.cds.adapter.odata.v2.utils;
import java.util.List;
import java.util.function.Function;
import com.sap.cds.adapter.odata.v2.query.expand.ExpandItem;
public class ExpandItemTreeBuilder {
public static ExpandItem buildTree(List extends List> paths, Function stringifier) {
ExpandItem root = new ExpandItem();
for (List path : paths) {
ExpandItem currentExpandItem = root;
for (T segment : path) {
String pathSegmentName = stringifier.apply(segment);
currentExpandItem = currentExpandItem.computeIfAbsent(pathSegmentName, k -> new ExpandItem());
}
}
return root;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy