All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.jsonnodes.expansion.JsonNodeExpansionModelImpl Maven / Gradle / Ivy

There is a newer version: 2.16.0
Show newest version
package io.sphere.sdk.jsonnodes.expansion;

import io.sphere.sdk.expansion.ExpansionModelImpl;
import io.sphere.sdk.expansion.ExpansionPath;
import io.sphere.sdk.expansion.ExpansionPathContainer;
import io.sphere.sdk.models.Base;

import java.util.List;

import static io.sphere.sdk.utils.SphereInternalUtils.listOf;
import static java.util.stream.Collectors.toList;

final class JsonNodeExpansionModelImpl extends ExpansionModelImpl implements JsonNodeExpansionModel {
    @Override
    public ExpansionPathContainer paths(final List expansionPaths) {
        final List> expansionPathList = expansionPaths.stream()
                .map(ExpansionPath::of)
                .collect(toList());
        return new ExpansionPathContainerImpl<>(expansionPathList);
    }

    @Override
    public ExpansionPathContainer paths(final String path, final String... morePaths) {
        return paths(listOf(path, morePaths));
    }

    private static class ExpansionPathContainerImpl extends Base implements ExpansionPathContainer {
        private final List> expansionPaths;

        public ExpansionPathContainerImpl(final List> expansionPaths) {
            this.expansionPaths = expansionPaths;
        }

        @Override
        public List> expansionPaths() {
            return expansionPaths;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy