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

com.github.davidmoten.odata.client.internal.ParameterMap Maven / Gradle / Ivy

package com.github.davidmoten.odata.client.internal;

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.Collectors;

public final class ParameterMap {

    public static Builder put(String key, String typeWithNamespace, Object value) {
        return new Builder().put(key, typeWithNamespace, value);
    }

    public static Map empty() {
        return Collections.emptyMap();
    }

    public static Map build() {
        return new Builder().build();
    }

    public static final class Builder {
        private final Map map = new LinkedHashMap<>();

        public Builder put(String key, String typeWithNamespace, Object value) {
            map.put(key, new TypedObject(typeWithNamespace, value));
            return this;
        }

        public Map build() {
            return map;
        }

    }

    public static Map toMap(Map map) {
        return map //
                .entrySet() //
                .stream() //
                .collect(Collectors.toMap( //
                        entry -> entry.getKey(), //
                        entry -> entry.getValue().object()));
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy